You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christer Lindh <ch...@eoncompany.com> on 2001/10/25 00:03:06 UTC

how to implement a dynamic sitemap?

As far as I've understood C2, there is now a quite static sitemap which tells what request gets what XSL. This is too static for my needs, I would like to do a bunch of calculations and then decide on what XSL to use. Is there any way I can accomplish this with C2?

I have my own producer today with Cocoon 1 which creates Documents from data in my database, and these are then assigned an XSL depending on a bunch of parameters (from the database and user environment as well), ie I add PI:s to the Document DOM dynamically.

So - is it possible to use "classic" cocoon1.8 processing instructions with cocoon2, instead of specifying processing stages in the sitemap?

If not, can I do my own implement of the Sitemap interfaces and get C2 to use those instead?  My classes would act just like a sitemap (as the interfaces are the same) but get it's daata from database instead of a XML file in the filesystem.




Re: how to implement a dynamic sitemap?

Posted by Sergio Carvalho <se...@acm.org>.
Christer Lindh wrote:

> As far as I've understood C2, there is now a quite static sitemap 
> which tells what request gets what XSL. This is too static for my 
> needs, I would like to do a bunch of calculations and then decide on 
> what XSL to use. Is there any way I can accomplish this with C2?
>
One possible way is to use an action to define a sitemap variable with 
the name of the chose stylesheet.
Your mathcer would then look like:
 <map:match...
  <map:act type="xsl-chooser">
   <map:generate...
   <map:transform src="stylesheets/{chosen-xsl}">
   ...



>  
>
> I have my own producer today with Cocoon 1 which creates Documents 
> from data in my database, and these are then assigned an XSL depending 
> on a bunch of parameters (from the database and user environment as 
> well), ie I add PI:s to the Document DOM dynamically.
>
>  
>
> So - is it possible to use "classic" cocoon1.8 processing instructions 
> with cocoon2, instead of specifying processing stages in the sitemap?
>
>  
>
> If not, can I do my own implement of the Sitemap interfaces and get C2 
> to use those instead?  My classes would act just like a sitemap (as 
> the interfaces are the same) but get it's daata from database instead 
> of a XML file in the filesystem.
>
>  
>
>  
>
>  
>




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: how to implement a dynamic sitemap?

Posted by Martin Man <Ma...@seznam.cz>.
On Thu, Oct 25, 2001 at 12:03:06AM +0200, Christer Lindh wrote:
> As far as I've understood C2, there is now a quite static sitemap which tells what request gets what XSL. This is too static for my needs, I would like to do a bunch of calculations and then decide on what XSL to use. Is there any way I can accomplish this with C2?
> 
> I have my own producer today with Cocoon 1 which creates Documents from data in my database, and these are then assigned an XSL depending on a bunch of parameters (from the database and user environment as well), ie I add PI:s to the Document DOM dynamically.
> 
> So - is it possible to use "classic" cocoon1.8 processing instructions with cocoon2, instead of specifying processing stages in the sitemap?
> 
> If not, can I do my own implement of the Sitemap interfaces and get C2 to use those instead?  My classes would act just like a sitemap (as the interfaces are the same) but get it's daata from database instead of a XML file in the filesystem.
> 
> 
> 


take a look at actions, they perfectly suit your case IMO, there is a bunch of
thm in the distro along with the documentation...


rgds,
martin
-- 
2CC0 4AF6 92DA 5CBF 5F09  7BCB 6202 7024 6E06 0223
http://mman.dyndns.org/mman.gpg

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: how to implement a dynamic sitemap?

Posted by "Piroumian, Konstantin" <KP...@flagship.ru>.
Simply use an "action" to do your calculations then return the result to
the sitemap:
 
<match pattern="*.xml">
    <generate src="{1}.xml" />
    <act type="select-stylesheet">
        <transform src="{style-sheet}.xsl" />  <!-- You should place a
value into the returning Map returned by your action at 'style-sheet'
key -->
    </act>
    <transform src="default.xsl" />
    <serialize />
</match>
 
Syntax is not exact, but you can easily understand what I mean if you
take a look at the sample sitemap.
 
Regards,
    Konstantin Piroumian

----- Original Message ----- 
From: Christer Lindh <ma...@eoncompany.com>  
To: cocoon-users@xml.apache.org <ma...@xml.apache.org>  
Sent: Thursday, October 25, 2001 2:03 AM
Subject: how to implement a dynamic sitemap?


As far as I've understood C2, there is now a quite static sitemap which
tells what request gets what XSL. This is too static for my needs, I
would like to do a bunch of calculations and then decide on what XSL to
use. Is there any way I can accomplish this with C2?
 
I have my own producer today with Cocoon 1 which creates Documents from
data in my database, and these are then assigned an XSL depending on a
bunch of parameters (from the database and user environment as well), ie
I add PI:s to the Document DOM dynamically.
 
So - is it possible to use "classic" cocoon1.8 processing instructions
with cocoon2, instead of specifying processing stages in the sitemap?
 
If not, can I do my own implement of the Sitemap interfaces and get C2
to use those instead?  My classes would act just like a sitemap (as the
interfaces are the same) but get it's daata from database instead of a
XML file in the filesystem.
 
 
 


Re: how to implement a dynamic sitemap?

Posted by Mario Muja <ma...@delaval.com>.
You can write your own actions, which return a value to the sitemap. This value can be used within the sitemap to decide, which XSL to use. In C2 you do not have to change your XML files to assign a stylesheet. This is handled dynamically by the stylesheet. From this point of view, I would say that the C1 approach is more static than the C2 sitemap. To get data from a database, I would use the ESQL logicsheet within an XSP.

Hint: I am not a C2 nor a Java expert. The above is, what I got from the documentation and from my own first C2 samples.

Regards, Mario

  ----- Original Message ----- 
  From: Christer Lindh 
  To: cocoon-users@xml.apache.org 
  Sent: Thursday, October 25, 2001 12:03 AM
  Subject: how to implement a dynamic sitemap?


  As far as I've understood C2, there is now a quite static sitemap which tells what request gets what XSL. This is too static for my needs, I would like to do a bunch of calculations and then decide on what XSL to use. Is there any way I can accomplish this with C2?

  I have my own producer today with Cocoon 1 which creates Documents from data in my database, and these are then assigned an XSL depending on a bunch of parameters (from the database and user environment as well), ie I add PI:s to the Document DOM dynamically.

  So - is it possible to use "classic" cocoon1.8 processing instructions with cocoon2, instead of specifying processing stages in the sitemap?

  If not, can I do my own implement of the Sitemap interfaces and get C2 to use those instead?  My classes would act just like a sitemap (as the interfaces are the same) but get it's daata from database instead of a XML file in the filesystem.




RE: how to implement a dynamic sitemap?

Posted by Liam Morley <lm...@WPI.EDU>.
Like many have said, actions work. Also, I usually do the processing in
the XSL, so when dealing with "what request gets what what XSL", it's
possible to have ALL requests go to the SAME xsl. Of course it depends
on your demands.
 
Liam Morley
 
-----Original Message-----
From: Christer Lindh [mailto:christer.lindh@eoncompany.com] 
Sent: Wednesday, October 24, 2001 6:03 PM
To: cocoon-users@xml.apache.org
Subject: how to implement a dynamic sitemap?
 
As far as I've understood C2, there is now a quite static sitemap which
tells what request gets what XSL. This is too static for my needs, I
would like to do a bunch of calculations and then decide on what XSL to
use. Is there any way I can accomplish this with C2?
 
I have my own producer today with Cocoon 1 which creates Documents from
data in my database, and these are then assigned an XSL depending on a
bunch of parameters (from the database and user environment as well), ie
I add PI:s to the Document DOM dynamically.
 
So - is it possible to use "classic" cocoon1.8 processing instructions
with cocoon2, instead of specifying processing stages in the sitemap?
 
If not, can I do my own implement of the Sitemap interfaces and get C2
to use those instead?  My classes would act just like a sitemap (as the
interfaces are the same) but get it's daata from database instead of a
XML file in the filesystem.