You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Piotr Legiecki <pi...@sci.pam.szczecin.pl> on 2002/11/14 13:52:47 UTC

Difference between cocoon: and file:// in map:part

Hi
I'm new to cocoon and don't get the difference between map:part src 
arguments:
....
map:part src="cocoon:/somefile.xml"
map:part src="cocoon:/anotherfile.xml"
....

means that cocoon should join two xml files (taken from some misterious 
place)

But the same happens with this:
....
map:part src="somefile.xml"
map:part src="anotherfile.xml"
.....

which means take two files from filesystem which is clear to me.

In my example:
....
  <map:pipeline>
      <map:match pattern="">
         <map:aggregate element="site">
           <map:part src="content/menu.xml"/>
           <map:part src="content/books.xml"/>
         </map:aggregate>
         <map:transform src="styles/simplemenu2html.xsl"/>
         <map:serialize/>
      </map:match>
   </map:pipeline>
....

It works ok, but using
...
src="cocoon:content/menu.xml"
...
instead doesn't (ie the rendered html page is empty). *Why*?

BTW, where is map:aggregate component *fully* documented? In main user 
documentation there is only one example and not all of the attributes 
are explained (ie strip-root, ne etc).

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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Difference between cocoon: and file:// in map:part

Posted by Reinhard Poetz <re...@gmx.net>.
Piotr,

At http://xml.apache.org/cocoon/userdocs/concepts/sitemap.html you should
find some answers to your questions.

Regards,
Reinhard

> -----Original Message-----
> From: Piotr Legiecki [mailto:piotrlg@sci.pam.szczecin.pl]
> Sent: Thursday, November 14, 2002 1:53 PM
> To: cocoon-users@xml.apache.org
> Subject: Difference between cocoon: and file:// in map:part
>
>
> Hi
> I'm new to cocoon and don't get the difference between map:part src
> arguments:
> ....
> map:part src="cocoon:/somefile.xml"
> map:part src="cocoon:/anotherfile.xml"
> ....
>
> means that cocoon should join two xml files (taken from some misterious
> place)
>
> But the same happens with this:
> ....
> map:part src="somefile.xml"
> map:part src="anotherfile.xml"
> .....
>
> which means take two files from filesystem which is clear to me.
>
> In my example:
> ....
>   <map:pipeline>
>       <map:match pattern="">
>          <map:aggregate element="site">
>            <map:part src="content/menu.xml"/>
>            <map:part src="content/books.xml"/>
>          </map:aggregate>
>          <map:transform src="styles/simplemenu2html.xsl"/>
>          <map:serialize/>
>       </map:match>
>    </map:pipeline>
> ....
>
> It works ok, but using
> ...
> src="cocoon:content/menu.xml"
> ...
> instead doesn't (ie the rendered html page is empty). *Why*?
>
> BTW, where is map:aggregate component *fully* documented? In main user
> documentation there is only one example and not all of the attributes
> are explained (ie strip-root, ne etc).
>
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: R: Difference between cocoon: and file:// in map:part

Posted by Reinhard Poetz <re...@gmx.net>.
Piotr,

> Here I don't need to transform one xml to another one. I need html as
> output.
>
> > 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.
>
> And this is what I don't want (ie one big xsl). I want one xsl for menu
> (and generally navigation) and one for content, so I will have a few
> small xsl files vs one big (easier to manage).
>
> So I think the second step is the way to go and manage xsl files using
> one 'main' (here menuandbook2html.xsl) xsl which includes the rest.

Yes, you can use includes within your stylesheet or you call in map:part
sub-pipelines which already return html (of course in xml).

I would prefer one stylesheet with includes.

Regards,
Reinhard

>
> Sounds reasonably?
>
> Thanx
> 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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: R: Difference between cocoon: and file:// in map:part

Posted by Piotr Legiecki <pi...@sci.pam.szczecin.pl>.
Reinhard Poetz wrote:


>>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"/>)

Here I don't need to transform one xml to another one. I need html as 
output.

> 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.

And this is what I don't want (ie one big xsl). I want one xsl for menu 
(and generally navigation) and one for content, so I will have a few 
small xsl files vs one big (easier to manage).

So I think the second step is the way to go and manage xsl files using 
one 'main' (here menuandbook2html.xsl) xsl which includes the rest.

Sounds reasonably?

Thanx
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: R: Difference between cocoon: and file:// in map:part

Posted by Reinhard Poetz <re...@gmx.net>.
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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


R: R: Difference between cocoon: and file:// in map:part

Posted by Luca Morandini <sp...@ipzs.it>.
Piotr,

> Right?

Yes :) But don't serialize those parts as HTML, use the XML serializer
instead.

> Hm. I'm not sure about it. What happens when line
> <map:part src="cocoon:/menu.xml"/>
> is executed? Cocoon jumps directly to pipeline which matches the
> pattern, makes something there (ie *map:read* (or should I use
> map:generate?) source xml, *transform* using xsl, *serialize* (is this
> neccessery here?)) and returns to second map:part.

Well, pipelines are pipelines, the "cocoon:" pseudo-protocol is just another
way to call them.

>
> So the joined parts are not xml files anymore but html files?

Parts should be XML to be aggregated, just use the XML serializer. BTW,
don't think of them as "files", but rather as "XML streams".

> 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;-)
>

This has been answered over and over... check the mailing list archives or
point your browser to:
http://xml.apache.org/cocoon/faq/faq-sitemap.html#faq-9

Best regards,

Luca Morandini
lmorandini@ieee.org


> -----Messaggio originale-----
> Da: Piotr Legiecki [mailto:piotrlg@sci.pam.szczecin.pl]
> Inviato: giovedi 14 novembre 2002 14.36
> A: cocoon-users@xml.apache.org
> Oggetto: 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? Cocoon jumps directly to pipeline which matches the
> pattern, makes something there (ie *map:read* (or should I use
> map:generate?) source xml, *transform* using xsl, *serialize* (is this
> neccessery here?)) and returns to second map:part.
>
> 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/>
>
> 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;-)
>
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


     We are protected from the virus by Norton Antivirus Corporate Edition

---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: R: Difference between cocoon: and file:// in map:part

Posted by Piotr Legiecki <pi...@sci.pam.szczecin.pl>.
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? Cocoon jumps directly to pipeline which matches the 
pattern, makes something there (ie *map:read* (or should I use 
map:generate?) source xml, *transform* using xsl, *serialize* (is this 
neccessery here?)) and returns to second map:part.

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/>

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;-)

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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


R: Difference between cocoon: and file:// in map:part

Posted by Luca Morandini <sp...@ipzs.it>.
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.

Best regards,

Luca Morandini
lmorandini@ieee.org

> -----Messaggio originale-----
> Da: Piotr Legiecki [mailto:piotrlg@sci.pam.szczecin.pl]
> Inviato: giovedi 14 novembre 2002 13.53
> A: cocoon-users@xml.apache.org
> Oggetto: Difference between cocoon: and file:// in map:part
>
>
> Hi
> I'm new to cocoon and don't get the difference between map:part src
> arguments:
> ....
> map:part src="cocoon:/somefile.xml"
> map:part src="cocoon:/anotherfile.xml"
> ....
>
> means that cocoon should join two xml files (taken from some misterious
> place)
>
> But the same happens with this:
> ....
> map:part src="somefile.xml"
> map:part src="anotherfile.xml"
> .....
>
> which means take two files from filesystem which is clear to me.
>
> In my example:
> ....
>   <map:pipeline>
>       <map:match pattern="">
>          <map:aggregate element="site">
>            <map:part src="content/menu.xml"/>
>            <map:part src="content/books.xml"/>
>          </map:aggregate>
>          <map:transform src="styles/simplemenu2html.xsl"/>
>          <map:serialize/>
>       </map:match>
>    </map:pipeline>
> ....
>
> It works ok, but using
> ...
> src="cocoon:content/menu.xml"
> ...
> instead doesn't (ie the rendered html page is empty). *Why*?
>
> BTW, where is map:aggregate component *fully* documented? In main user
> documentation there is only one example and not all of the attributes
> are explained (ie strip-root, ne etc).
>
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


     We are protected from the virus by Norton Antivirus Corporate Edition

---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>