cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Gries <>
Subject Re: How can I get both a HTML and a PDF output from the same XML source file?
Date Sun, 11 Feb 2001 16:48:39 GMT

if you can use a parameter to specify the output format, then following 
style should work (you have to refer to it in your xml file, of course).

At leats I use it in this way:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
<xsl:param name="out"/>
<xsl:param name="lang"/>

<xsl:template match="/">
   <xsl:when test="$out='html'">
   <xsl:when test="$out='pdf'">
   <xsl:when test="$out='xml'">

<xsl:copy-of select="*root node of your xml source file*"/>


Hope this helps.
Olli wrote:

> I thoroughly read the FAQ (in particular the "How do I chain stylesheets" 
> item) and I tried hard to get both a (X)HTML and a PDF output from the
> same XML source file by applying two different XSL-T stylesheets.
> The first stylesheet is a regular XML->(X)HTML converter and it works fine.
> The second stylesheet tries to create a XSL-FO file from the XML source
> and post-process it with the Cocoon XSL:FO engine. This second XSL-T
> stylesheet does not work. I'm able to get a valid PDF file sent to my
> internet browser (MS IE 5.5 on Windows 98) but this PDF file is presented 
> in the browser window as it was a ASCII text file. Acrobat Reader is not
> invoked by the browser.
> As long as I can understand, this happens because of the lacking of the
> <?xml version="1.0"?> element in the XSL:FO output produced by my XSL-T
> stylesheet. Unfortunatley, I cannot insert this element in my output
> using the "xsl:processing-instruction" because the XSL engine complains
> about an illegal operation ('processing-instruction cannot be "xml"'). I
> did not understand how to use the second technique mentioned in the "my
> processing instruction disapper..." of the FAQ, that is by using an
> "apply-templates" element that matches processing instructions, so I did
> not try it.
> Does anybody know how to get both HTML and PDF output from the same XML
> file by applying two different stylesheets?
> Does anybody have a working example of a single XML file converted into
> both HTML and PDF using different stylesheets?
> Many thanks in advance
> ---------------------
> Alessandro Bottoni
> Web Architect
> Quadrante SRL - Italy
> office:
> personal:
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <>
> To unsubscribe, e-mail: <>
> For additional commands, e-mail: <>

View raw message