Thanx for your help :)
(1) Martin Honnen replied:
> 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>
Thanx a lot, that did it.
Sorry for this, I forgot that XSLT also has functions, I just spent time going
through the XPath spec :(
(2) David Carlisle told me to replace the ugly "*[local-name()='xxx']" by
"h:xxx"
but then I run into namespace problems (this why I put them there in the first
place). Of course it's likely that I did something wrong again but I tried
several combinations. If you have another 3 minutes to spare, could you
look at bad files below. I think I did as you told... Main problem is a wrong
namespace declaration:
html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://www.w3.org/1999/xhtml">
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
Note: If I batch process the files and name output as *.html they will show of
course, but are not valid....
(3) I then tried to number chapters. Sort of works, but then Firefox (both 1.5
on Linux and 2.0 on Win take like MINUTES (!) when files get bigger and I have
good hardware).
For once, no problem with IE 6 :) ... nor Saxon of course.
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
Is something like this bad ? (thanx for any help !!)
(the full code is in the above small xhtml-toc-numbered.xsl sample and works
with small files)
<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>
<xsl:template match="*[local-name()='h2']">
<h2><a name="h2_{generate-id(.)}">
<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>
<xsl:value-of select="."/></a> (<a href="#toc">«up</a>)</h2>
</xsl:template>
- greetings ! - Daniel
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--