Sherzod Ruzmetov wrote:
:I prefer descriptive ids/anchors:
:
:Instead of
:http://author.handalak.com/xml/about.xml#sect_II
:I'd do s.th. like
:http://author.handalak.com/xml/about.xml#whatisxmlandxsl
That's what the first revision did. If you open the .xml file source
(by appending ?source=1 to the url) you will see that I
assigned "id" to each <sect>. I didn't like assigning ids manually,
neither do I
so I thought there had to be an easier way, and guess what, there was
:-).
Yes.
I am generating the descriptive IDs from the section titles:
<t:template name="toc" xml:space="preserve">
<div id="tocunit">
<h2>
<a id="toc" name="toc">
<acronym title="Table Of Contents">TOC</acronym> (this page):
</a>
</h2>
<ul title="toc" class="inline">
<li class="skipNavigation">
<a href="#main">To Content</a>,
</li>
<t:for-each select="//sect1" xml:space="default">
<li>
<a>
<t:attribute name="href">
<t:text>#</t:text>
<t:call-template name="clean">
<t:with-param name="input" select="title"/>
</t:call-template>
</t:attribute>
<t:value-of select="title"/>
</a>
<t:if test="following::sect1">
<t:text>, </t:text>
</t:if>
</li>
<t:text>
</t:text>
</t:for-each>
</ul>
</div>
</t:template>
template name="clean" strips spaces, some characters, and lowercases the string.
Tobi
--
Vim users donate.
http://iccf-holland.org/donate.html
Web developers check.
http://www.pinkjuice.com/check/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list