[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Findings: Merging XSL:FO & HTML Style Sheets
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|