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]
