PDA

View Full Version : XSL multiple output files


macchisp
06-06-2006, 09:01 PM
Hey all,

I was wondering if anyone can help me out with having one XML file that goes through an XSL stylesheet that outputs two XHTML pages.

Let me give you the test code that I've been working with:
staff.xml
<staff>
<is>
<cd>
<first>John</first>
<last>Doe</last>
<room>178</room>
<email>doejx@domain.com</email>
</cd>
</is>
<ts>
<cd>
<first>Jane</first>
<last>Doe</last>
<room>278</room>
<email>doe2jx@domain.com</email>
</cd>
</ts>
</staff>

staff.xsl
<table border="0" cellpadding="5" cellspacing="5">
<xsl:for-each select="staff/is/cd">
<tr>
<td>
<xsl:attribute name="align">left</xsl:attribute>
<strong><xsl:value-of select="last" />,
<xsl:value-of select="first" /></strong><br />
Room Number: <xsl:value-of select="room" /><br />
E-mail: <a><xsl:attribute name="href">mailto:<xsl:value-of email" />
</xsl:attribute>
<xsl:value-of select="email" />
</a>
</td>
</tr>
</xsl:for-each>
</table>

Right now I understand the XSL above will only select the <is> and display it. What I would like to do is have the <ts> tag go to one html file and the <is> go to another html file.

Please ask questions if I did not make it clear.

Thanks for all the help.

KC-Luck
06-06-2006, 09:28 PM
Multiple output streams via one xsl file is part of XSL 2.0 (http://www.w3.org/TR/xslt20/#creating-result-trees), and still only a draft.
You could possibly send in a parameter to do a this or that approach, and transform against your xml multiple times.

ealbrecht
06-13-2006, 06:37 PM
You could always have a parent html page that loads two xsl files and then load and transform the xml to each xsl file. The resulting transformations can then be loaded into separate pages.