Hi Marco

Yes your idea will work, and in fact I think you've given a very clear
expression of the usual pattern for "chunking" using Cocoon. Perhaps you
could post a version of your email as a "HowTo" on the Wiki, and add a link
from the "HowTos" page?
http://wiki.cocoondev.org/Wiki.jsp?page=HowTos

Many people have XSLT stylesheets to do chunking that use
processor-extensions to change the output document as they process the
input. These aren't going to work in Cocoon, so a "chunking" HowTo would be
especially useful to people migrating this code to Cocoon.

Cheers

Con

> -----Original Message-----
> From: Marco Stolpe [mailto:[EMAIL PROTECTED]
> Sent: Monday, 21 July 2003 06:10
> To: [EMAIL PROTECTED]
> Subject: Re: How to redirect XSL output to more than one file?
>
>
> Alexander Schatten wrote:
> > Marco Stolpe wrote:
> >> One solution which came to my mind was to use XSP together
> with fields
> >> in a query string pointing to the portion of the document the user
> >> likes to read. But I'm asking myself if this is the best solution
> >> available, since using XSP wouldn't be a very portable
> solution, would
> >> it? Moreover, could I still produce a static version of
> the document
> >> (consisting of several files) using Cocoon from the
> command line with
> >> XSP?
> >>
> > I think XSP is not necessarily required. you can do this in
> a stylesheet
> > approach too. but it is very dependend on the problem.
> >
> > consider a document having parts like this:
> >
> > <part id="i1">
> > ...
> > </part>
> >
> > <part id="i2">
> > ...
> > </part>
> >
> > and so on, then you could write "simply" XSLT stylesheets
> that create an
> > index page with links, as well as stylesheet(s) that render
> one part
> > with a previous/next function.
>
> In fact, this is exactly the structure of a document I had thought of
> (like a book consisting of chapters or a presentation consisting of
> slides, all having a unique name/id). One idea I had was the
> same you're
> suggesting: create a stylesheet producing an index page with links to
> the chapters and a stylesheet rendering a single chapter
> (together with
> a navigation bar).
>
> The only question left was how to tell the stylesheet
> rendering a single
> chapter what chapter to render. It came to my mind that
> stylesheets can
> use parameters, but it still isn't entirely clear to me how to "hand
> them over" to a template dynamically. I remembered that with
> XSP one can
> use parameters of a query string in XML documents/stylesheets. With a
> document named mybook.xml, that might lead to index links of the form
>
> mybook.xml?chapter=intro
> mybook.xml?chapter=chap1
> mybook.xml?chapter=chap2 ...
>
> and to a stylesheet rendering the document based on the chapter ID.
>
> Now that you told me one could do that without XSP, I looked at the
> documentation again. In the user docs about the XSLT
> transformer I found
> the statement: "In addition all other parameters to the
> transformer are
> available in the stylesheet as <xsl:param/>s (These values
> are also used
> in the caching algorithm.)". It appears to me I have to use
> the sitemap
> and matching to achieve what I want:
>
> <map:match pattern="book/**.html">
>    <map:generate src="books/{1}.xml"/>
>    <map:transform src="stylesheets/book-index.xsl"/>
>    <map:serialize/>
> </map:match>
>
> The stylesheet "book-index.xsl" would produce links of the form
>
> mybook-intro.html
> mybook-chap1.html
> mybook-chap2.html
> ...
>
> which could be matched with
>
> <map:match pattern="book/**-**.html">
>    <map:generate src="books/{1}.xml"/>
>    <map:transform src="stylesheets/book-chapter.xsl">
>      <map:parameter name="chapter" value="{2}"/>
>    </map:transform>
>    <map:serialize/>
> </map:match>
>
> Would that approach work or did I misunderstand anything?
>
> Thanks,
> Marco
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to