cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reinhard Poetz" <reinhard_po...@gmx.net>
Subject RE: R: Difference between cocoon: and file:// in map:part
Date Thu, 14 Nov 2002 14:05:13 GMT
Piotr,

> -----Original Message-----
> From: Piotr Legiecki [mailto:piotrlg@sci.pam.szczecin.pl]
> Sent: Thursday, November 14, 2002 2:36 PM
> To: cocoon-users@xml.apache.org
> Subject: Re: R: Difference between cocoon: and file:// in map:part
>
>
> Luca Morandini wrote:
> > Piotr,
> >
> > the "cocoon:" pseudo-protocol doesn't search for files, but for
> pipelines.
> >
> > With this pseudo-protocol you can build pipelines and call them (more or
> > less as subroutines) from any aggregation.
> >
>
> I see. So when I want to separate navigation and content (having
> menu.xml and books.xml) and join them using aggregate, *but* use
> different xsl files for them I can write something like this:
>
>    <map:pipeline>
>        <map:match pattern="">
>           <map:aggregate element="site">
>             <map:part src="cocoon:/menu.xml"/>
>             <map:part src="cocoon:/books.xml"/>
>           </map:aggregate>
>           <map:transform src="styles/menuandbook2html.xsl"/>
>           <map:serialize/>
>        </map:match>
>    </map:pipeline>
>
>
>    <map:pipeline>
>        <map:match pattern="menu.xml">
>          <map:read src="content/menu.xml"/>
>          <map:transform src="styles/menu.xsl"/>
>          <map:serialize/>
>        </map:match>
>    </map:pipeline>
>
>    <map:pipeline>
>        <map:match pattern="books.xml">
>          <map:read src="content/books.xml"/>
>          <map:transform src="styles/books.xsl"/>
>          <map:serialize/>
>        </map:match>
>    </map:pipeline>
>
> Right? Hm. I'm not sure about it. What happens when line
> <map:part src="cocoon:/menu.xml"/>
> is executed?

XML which is produced by the pipelines (called by map:part) will be
integrated in your "main" pipeline.

> Cocoon jumps directly to pipeline which matches the
> pattern, makes something there (ie *map:read* (or should I use
> map:generate?)

You *must* use map:generate in this case. A reader is a generator and a
serializer in one and usally used for non-xml files like pictures. Therefore
it shouldn't be possible to call a pipeline with a reader from a aggregator
pipeline.

> source xml, *transform* using xsl, *serialize* (is this
> neccessery here?)) and returns to second map:part.

I think it's neccessary here because otherwise your pipeline is not valid.
As far as I know each pipeline needs one generator/aggregator and one
serializer. Between them you can place as many transformers as you need.

The serializer in this case will not be called - your pipelines called by
map:part retrun sax events and not serialized data.

>
> So the joined parts are not xml files anymore but html files?  So I
> can't use
>   <map:transform src="styles/menuandbook2html.xsl"/>
> on them anymore and I can't also use
>   <map:serialize/>

You have to possiblities:

1. Each of the map:part-pipelines returns the xml in the form you need it
for your client. But make sure to use the XML serializer and not the
html-serizalizer. (map:serialize type="xml"/>)

2.
         <map:aggregate element="site">
            <map:part src="content/menu.xml"/>
            <map:part src="content/books.xml"/>
         </map:aggregate>
         <map:transform src="styles/menuandbook2html.xsl"/>
         <map:serialize type="html"/>

In this case you read your books and your menu directly (without using
sub-pipelines) and you only have one stylesheets that transforms your xml in
html.

>
> Is it the right way to use aggregate or I have simply missused
> this feature?
>
> And when use separate <map:pipeline> for matches and when to group this
> matches under one <map:pipeline>? I know it looks like completely
> another question;-)

Have a look at http://outerthought.net/wiki/Wiki.jsp?page=DesignPipelines

Regards,
Reinhard

>
> Regards
> Piotr Legiecki
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
>


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

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


Mime
View raw message