cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Menke" <>
Subject RE: How can I get both a HTML and a PDF output from the same XML source file?
Date Sun, 11 Feb 2001 17:19:35 GMT
I use the following code at the top of my XML files.  It checks the query
string for a value and picks the correct Stylesheet.

<?xml version="1.0"?>
<!-- edited with XML Spy v3.5 ( by john menke (eagle
information systems) -->
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<xsp:page language="java" xmlns:xsp="">
	<page title="My Page">

	String[] param = request.getParameterValues("dummy");
	String stylesheet;
	if (param != null) {
		stylesheet = "pdf.xsl";
	} else {
		stylesheet = "html.xsl";

		<xsp:pi target="xml-stylesheet">

> -----Original Message-----
> From: []
> Sent: Sunday, February 11, 2001 6:49 AM
> To:
> Subject: How can I get both a HTML and a PDF output from the same XML
> source file?
> 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