cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aurélien DEHAY" <aurelien.de...@sncf.fr>
Subject Re: Cocoon's issues with multiple stylesheets / multiple input do cuments
Date Tue, 29 Aug 2000 13:04:38 GMT
Thorbjørn Ravn Andersen <TRA@stibo.dk> writes:

> > to - the stylesheet is bolted onto the XML as surely as if 
> > they were the same
> > file.
> 
> Cocoon 1 does not have any provisions for using an external
> mechanism to decide what style sheets to apply to a given XML file,
> but the Processing Instruction you are having trouble with.

But Cocoon offers to do a thing like this:

<?cocoon-process type="xslt"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <xsl:param name="format">html</xsl:param>

  <xsl:template match="document">
	 <xsl:choose>
		<xsl:when test="$format='pdf'">
		  <xsl:processing-instruction name="cocoon-format">type="text/xslfo"</xsl:processing-instruction>
		  <xsl:processing-instruction name="xml-stylesheet">version="1.0" href="/styles/xsl/document-pdf.xsl"</xsl:processing-instruction>
		</xsl:when>
		<xsl:when test="$format='html'">
		  <xsl:processing-instruction name="cocoon-process">type="xslt"</xsl:processing-instruction>
		  <xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>
		  <xsl:processing-instruction name="xml-stylesheet">version="1.0" href="/styles/xsl/document-html.xsl"
type="text/xsl"</xsl:processing-instruction>
		</xsl:when>
	 </xsl:choose>

	 <xsl:copy>
		<xsl:apply-templates select="@*"/>
		<xsl:apply-templates select="node()"/>
	 </xsl:copy>
  </xsl:template>

  <xsl:template match="@*|*|text()">
	 <xsl:copy>
		<xsl:apply-templates select="@*|*|text()"/>
	 </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Maybe it's not a beautifull peace of code, it's work.

> 
> 
> The standard answer is to use Cocoon 2 since such a mechanism is
> available there, but I have not tried it myself.

When snapshots of the CVSROOT will be online? I can't access to the
CVS (it's just beaucoup we don't have masquering here: whe're behind a
proxy).

-- 
Aurélien

Mime
View raw message