[Home] [By Thread] [By Date] [Recent Entries]


Shadab,

You can have multiple result documents with the current version of Saxon
(7.4, http://saxon.sf.net) using the XSLT 2.0 xsl:result-document element
(http://www.w3.org/TR/xslt20/#element-result-document). Saxon 7.4 is a
partial, experimental implementation of the working draft XSLT 2.0 spec.
Also note that in XSLT 2.0, you can name output formats with a name
attribute. An example follows.

Mike



C:\Temp>cat test.xml
<hello>Hi!</hello>

C:\Temp>cat result.xsl
<xsl:transform version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:output name="rt" method="html"/>
<xsl:variable name="dir">file:///C:/temp</xsl:variable>

<xsl:template match="/">
    <xsl:result-document format="rt" href="{$dir}/test.html">
        <html><body>
            <p><xsl:apply-templates/></p>
        </body></html>
    </xsl:result-document>
    <xsl:result-document format="rt" href="{$dir}/test1.html">
        <html><body>
            <p><b><xsl:apply-templates/></b></p>
        </body></html>
    </xsl:result-document>
  That's all, folks...
</xsl:template>

</xsl:transform>

C:\Temp>java -jar c:/lib/saxon7.jar test.xml result.xsl

  That's all, folks...

C:\Temp>cat test.html
<html>
   <body>
      <p>Hi!</p>
   </body>
</html>
C:\Temp>cat test1.html
<html>
   <body>
      <p><b>Hi!</b></p>
   </body>
</html>
C:\Temp>





-----Original Message-----
From: shadab [mailto:mohammad.shadab@a...]
Sent: Friday, April 18, 2003 2:57 AM
To: xml-dev@l...
Subject:  multiple output for a single xsl


Hi,

It is possible to load and process multiple input xml using a single
xsl.What about the opposite case, when you need more than one output
document? What about creating several output XML documents from one style
sheet?

Shadab


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member