Subject: RE: [xsl] html toc From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Wed, 23 Feb 2005 18:13:27 -0000 |
Try a search for "XSLT positional grouping". It's much easier in 2.0, using <xsl:for-each-group group-starting-with="h2">. In 1.0, think in terms of using xsl:apply-templates to traverse the logical tree instead of the physical tree. That means that when you're on an h2, you want to select the logically subordinate h3 elements, which you can do like this: select="following-sibling::h3[generate-id(preceding-sibling::h2[1]) = generate-id(current())]" Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: carst@xxxxxxxxxx [mailto:carst@xxxxxxxxxx] > Sent: 23 February 2005 17:39 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] html toc > > I don't know how to do this. > > <h1>first level</h1> > ... > <h2>second</h2> > ... > <h3>third<h3> > ... > <h3>third o</h3> > ... > <h1>first o</h1> > > currently this is transformed into a ToC using a table where > i make use of a <xsl:choose> and test for element name > (h1, h2, h3) and insert the appropriate columns to have > indention between the headline levels. > > i want to improve the ToC and make it into a menu which > uses the css 'display:none' and javascript to toggleDisplay. > for this, it would be much easier to have a list instead of a > table. would look like this: > > <ul> > <li>first level</li> > <li><ul> > <li>second</li> > <li><ul> > <li>third</li> > <li>third o</li> > </ul></li> > </ul></li> > <li>first o</li> > </ul> > > 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'. > > any ideas? > > Thanks, > Carst > -- > Carsten Heinrigs > Ocean-7 Development > Tel: 212 533-8460
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] html toc, Wendell Piez | Thread | Re: [xsl] html toc, Joris Gillis |
Re: [xsl] xsl recursion, Jon Gorman | Date | Re: [xsl] html toc, Joris Gillis |
Month |