|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: html toc
Tempore 18:38:40, die 02/23/2005 AD, hinc in
xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit <carst@xxxxxxxxxx>:
my problem is that all the headline elements are part of the same axis and i don't know how do the transformation without something like a 'break loop', or 'select all following 'h3' until the next 'h2' or 'h1'. Hi, Here you have a working XSLT 1.0 example (uses key grouping) <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:key name="header" match="*[starts-with(local-name(),'h')]" use="generate-id(preceding-sibling::*[local-name()=concat('h', number(substring-after(local-name(current()),'h')) - 1)][1])"/> <xsl:template match="*[h1]"> <ul> <xsl:apply-templates select="h1"/> </ul> </xsl:template> <xsl:template match="*[starts-with(local-name(),'h')]">
<li><xsl:value-of select="."/></li>
<xsl:if test="key('header',generate-id())">
<ul>
<xsl:apply-templates select="key('header',generate-id())"/>
</ul>
</xsl:if>
</xsl:template></xsl:stylesheet>
|
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








