Steve Muench If I'm understanding what you want: | a reusable "chunk" of tags and <xsl:***> elements | | that is responsible for handling the formatting for
the "ChargeListRSQ" block of your source document | | In a way that allows the "chunk" of tags to
use xpath expressions that are relative to the
"ChargeListRSQ" | | Without mentioning a particular XML file that <ChargeListRSQ>
"lives in"... |
Then an <xsl:template> can do all these for you. Let's say your data looks like this: <TR300>
<ChargeListRSQ>
<Charge id="1">ABC</Charge>
<Charge id="2">DEF</Charge>
</ChargeListRSQ>
</TR300>Then you can create a "tab.xsl" stylesheet with a template
whose match pattern is match="ChargeListRSQ", and it will <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- This template handles ChargeListRSQ "block" -->
<xsl:template match='ChargeListRSQ'>
<table border="1">
<xsl:for-each select="Charge">
<tr>
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>and then include "tab.xsl" into another main stylesheet like "main.xsl"... <xsl:output method="html" indent="yes"/>
<xsl:include href="tab.xsl"/>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>And by the magic of the "Apply Templates" processing, when it comes
time for handle the formatting for the <ChargeListRSQ> in the source,
your template will "fire" and your reusable chunk of tags will kick in. |