|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Limitations of Includes in XSL
Ken,
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.
______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
Business Components for Java & XSQL Servlet Development Teams
Oracle Rep to the W3C XSL Working Group
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
|

Cart








