Subject: Re: [xsl] XHTML table of contents with XSLT From: "Daniel K. Schneider" <Daniel.Schneider@xxxxxxxxxxxxxx> Date: Sat, 24 Feb 2007 16:35:58 +0100 |
> You can use the generate-id function to generate ids for the hn elements and > use them as anchors in your table of contents. > <http://www.w3.org/TR/xslt#function-generate-id>
Good: http://tecfa.unige.ch/guides/xml/examples/xsl-toc/xhtml-sample.xml http://tecfa.unige.ch/guides/xml/examples/xsl-toc/xhtml-toc.xsl
Bad: http://tecfa.unige.ch/guides/xml/examples/xsl-toc/xhtml-sample-bad.xml http://tecfa.unige.ch/guides/xml/examples/xsl-toc/xhtml-toc-bad.xsl http://tecfa.unige.ch/guides/xml/examples/xsl-toc/xhtml-sample-bad2.xml http://tecfa.unige.ch/guides/xml/examples/xsl-toc/xhtml-toc-bad2.xsl
Works only with small files: http://tecfa.unige.ch/guides/xml/examples/xsl-toc/xhtml-sample-numered.xml http://tecfa.unige.ch/guides/xml/examples/xsl-toc/xhtml-toc-numbered.xsl
<xsl:template match="*[local-name()='h2']" mode="toc"> <span style="font-size:small;"> <xsl:text>   ' </xsl:text> <xsl:number level="any" from="*[local-name()='body']" count="*[local-name()='h1']"/> <xsl:text>.</xsl:text> <xsl:number level="any" from="*[local-name()='h1']" count="*[local-name()='h2']"/> <xsl:text> </xsl:text> <a href="#h2_{generate-id(.)}"><xsl:value-of select="."/></a> </span> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XHTML table of contents w, David Carlisle | Thread | Re: [xsl] XHTML table of contents w, Martin Honnen |
Re: [xsl] (Slightly) OT: Generating, Paul Tyson | Date | Re: [xsl] XHTML table of contents w, Martin Honnen |
Month |