You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marco Stolpe <fi...@gmx.net> on 2003/07/19 13:52:27 UTC
How to redirect XSL output to more than one file?
Hi,
I'm rather new to Cocoon and XSL, but already have used Xalan together
with DocBook stylesheets to produce HTML and PDF documents. Having read
some of Cocoons online documentation and searched the mailing list
archive there still remains the following question.
Let us assume I have created a rather huge document (a book, thesis,
whatever) I'd like to publish on the web. A user visiting the web site
should be able to view the document online in HTML-format, download the
HTML version as a compressed ZIP-file or download one single PDF file.
It's clear to me that I can produce one single PDF file with Cocoon, but
how can I produce an online (or zipped download) version distributed
among several output files in HTML format? It would be painful for any
reader to look at one single HTML file consisting of maybe a hundred of
pages. I'm not only interested in a solution for DocBook, but a general
one. For example, it would be nice to create a presentation consisting
of several slides in one XML file, but only to show one single slide on
screen.
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?
Thanks in advance for any help/hint,
Marco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: How to redirect XSL output to more than one file?
Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Marco,
I can't recommend to transform big documents like you DocBook book with
huge stylesheets like DocBook XSL. The transformation will take too much
time for a user.
But it's not impossible. You can for example use the chunk.xsl in the
DocBook XSL for chunking a document in different HTML files (It uses
Xalan redirect extension for output in different files). If a user
requests one of those pages, you can test if it exists
(ResourceExistsAction) and if not transform it before.
But the best would be to transform it on the commandline (independent of
Cocoon) and deliver them as they are.
Marco Stolpe wrote:
> Hi,
>
> I'm rather new to Cocoon and XSL, but already have used Xalan together
> with DocBook stylesheets to produce HTML and PDF documents. Having read
> some of Cocoons online documentation and searched the mailing list
> archive there still remains the following question.
>
> Let us assume I have created a rather huge document (a book, thesis,
> whatever) I'd like to publish on the web. A user visiting the web site
> should be able to view the document online in HTML-format, download the
> HTML version as a compressed ZIP-file or download one single PDF file.
>
> It's clear to me that I can produce one single PDF file with Cocoon, but
> how can I produce an online (or zipped download) version distributed
> among several output files in HTML format? It would be painful for any
> reader to look at one single HTML file consisting of maybe a hundred of
> pages. I'm not only interested in a solution for DocBook, but a general
> one. For example, it would be nice to create a presentation consisting
> of several slides in one XML file, but only to show one single slide on
> screen.
>
> 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?
>
> Thanks in advance for any help/hint,
>
> Marco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: How to redirect XSL output to more than one file?
Posted by Alexander Schatten <al...@gmx.at>.
Marco Stolpe wrote:
>
> Would that approach work or did I misunderstand anything?
>
this approach looks good to me; just two remarks: if those are all parts
of one document, one could eventually also consider using get parameters
for selection like:
document-name.html?part=idxyz
additionally eventually use ID attributes for selection, this would
guarantee that they are unique...
alex
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: How to redirect XSL output to more than one file?
Posted by Conal Tuohy <co...@paradise.net.nz>.
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:fireglyph@gmx.net]
> Sent: Monday, 21 July 2003 06:10
> To: users@cocoon.apache.org
> 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: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: How to redirect XSL output to more than one file?
Posted by Marco Stolpe <fi...@gmx.net>.
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: How to redirect XSL output to more than one file?
Posted by Alexander Schatten <al...@gmx.at>.
Marco Stolpe wrote:
>
> It's clear to me that I can produce one single PDF file with Cocoon,
> but how can I produce an online (or zipped download) version
> distributed among several output files in HTML format? It would be
> painful for any reader to look at one single HTML file consisting of
> maybe a hundred of pages. I'm not only interested in a solution for
> DocBook, but a general one. For example, it would be nice to create a
> presentation consisting of several slides in one XML file, but only to
> show one single slide on screen.
as someone gave you already feedback about the docbook problems I want
to suggest a more general approach:
>
> 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.
So you see, XSP is not required here, though possible.
What is indeed far more difficult if page breaks have to be done using a
more complex logic; e.g. pages should be approximately of similar size;
so that you need to cound words and implement some "intelligent" page
break logic or something... but as long as you can break at particular
structure elements, it is not so difficult to solve.
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
check well-formedness and return simple errors
Posted by François Parlant <fx...@laposte.net>.
Hi,
Thanks to help me.
I need to check if the document send to me is well-formed xml (not validate
it, just well-formedness), and return the errors IN A USER READABLE way, I
mean, not a lot of java stacktrace, but only "element y starts before x
ends...".
Is there something to do that ?
Thanks in advance for any hint
(I'm ok with sitemaps, but not an expert at all with java)
François
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: How to redirect XSL output to more than one file?
Posted by Conal Tuohy <co...@paradise.net.nz>.
Hi Marco
Some others have already addressed the issue of chunking, but I'd like to
point out that Cocoon also has a ZipArchiveSerializer which you can use both
for the chunking AND/OR to bundle the final HTML pages together into a
single package for download.
http://cocoon.apache.org/2.1/userdocs/serializers/ziparchive-serializer.html
Cheers
Con
> -----Original Message-----
> From: Marco Stolpe [mailto:fireglyph@gmx.net]
> Sent: Saturday, 19 July 2003 23:52
> To: users@cocoon.apache.org
> Subject: How to redirect XSL output to more than one file?
>
>
> Hi,
>
> I'm rather new to Cocoon and XSL, but already have used Xalan
> together
> with DocBook stylesheets to produce HTML and PDF documents.
> Having read
> some of Cocoons online documentation and searched the mailing list
> archive there still remains the following question.
>
> Let us assume I have created a rather huge document (a book, thesis,
> whatever) I'd like to publish on the web. A user visiting the
> web site
> should be able to view the document online in HTML-format,
> download the
> HTML version as a compressed ZIP-file or download one single PDF file.
>
> It's clear to me that I can produce one single PDF file with
> Cocoon, but
> how can I produce an online (or zipped download) version distributed
> among several output files in HTML format? It would be
> painful for any
> reader to look at one single HTML file consisting of maybe a
> hundred of
> pages. I'm not only interested in a solution for DocBook, but
> a general
> one. For example, it would be nice to create a presentation
> consisting
> of several slides in one XML file, but only to show one
> single slide on
> screen.
>
> 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?
>
> Thanks in advance for any help/hint,
>
> Marco
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org