[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Findings: Merging XSL:FO & HTML Style Sheets

Subject: Re: Findings: Merging XSL:FO & HTML Style Sheets
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 6 Mar 2002 10:01:50 +0000
xsl fo href
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.