This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Findings: Merging XSL:FO & HTML Style Sheets
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: xsl-list <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 6 Mar 2002 10:01:50 +0000
- Subject: Re: [xsl] Findings: Merging XSL:FO & HTML Style Sheets
- Organization: Jeni Tennison Consulting Ltd
- References: <20020305135408.98936.qmail@web20309.mail.yahoo.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Peter Bray wrote:
> The wrappers are necessary as the <xsl:output> element's attributes
> can not be substituted with parameters/variables and XSLT does not
> support <xsl:choose> outside of <xsl:template>. The wrappers consist
> merely of the standard header trailer for valid XSLT, an
> <xsl:output> element setting up the necessary parameters for each
> generation mode and an <xsl:include> of the core XSLT file.
Just to note that this particular case, where you want to alter the
values of the attributes of the xsl:output element, is addressed in
the XSLT 2.0 Working Draft - all the attributes of xsl:output (aside
from 'name') are attribute value templates.
Having said that, I think that a more elegant way to determine output
based on some parameter, given the capabilities of XSLT 2.0, would be
to have two output declarations:
<xsl:output name="html" method="html" ... />
<xsl:output name="fo" method="xml" ... />
And determine which was used with a xsl:result-document element in
the template matching the root node:
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$format = 'html'">
<xsl:result-document format="html" href="result.html">
<xsl:apply-templates mode="html" />
</xsl:result-document>
</xsl:when>
<xsl:otherwise>
<xsl:result-document format="fo" href="result.fo">
<xsl:apply-templates mode="fo" />
</xsl:result-document>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list