[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: generating <a href="#section"> menus. Related to <

Subject: Re: generating <a href="#section"> menus. Related to <xsl:for-each> and generate-id()
From: Tobias Reif <tobiasreif@xxxxxxxxxxxxx>
Date: Tue, 14 Jan 2003 15:17:24 +0100
input href
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>&#xA;</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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.