|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Table of contents - for-each question
Hi,
Catching up, At 11:34 AM 1/24/2006, llobash@xxxxxxxx wrote: I am attempting to create a table of contents to include all elements with <head> tag + all (c01) elements with "series" attribute and (c02 or c03) elements with "subseries" attributes. c0x tags from Encoded Archival Description standards, probably not important. Table of contents does require indentation based on level in heirarchy. This would be *much* easier if you used the "plain" <c> elements instead of the pernicious c0x elements, whose spurious numbered element typing, as you've discovered, just gets in the way of their @level typing, which is what you really care about -- resulting in the nasty code David showed. If you can't do that (maybe your writers insist for some unfathomable reason that c0x elements are easier), you can convert c0x elements easily to c elements with a modified identity transform: <xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template><xsl:template match="c01 | c02 | c03 | c04 | c05 | c06 | c07 | c08 | c09 | c10"> <c> <xsl:copy-of select="@*"/> <xsl:apply-templates select="node()"/> </c> </xsl:template> Then problems like yours (the ToC thing) become much easier and cleaner. If for some reason you have to convert the opposite way -- an EAD instance that uses plain components into one that uses numbered components -- that's a bit harder; but it's still a stylesheet in two templates. Cheers, Wendell
|
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








