Altova Mailing List Archives


Re: [xsl] generating numbers for anchor tabindex

From: Jeni Tennison <jeni@---------------->
To:
Date: 10/6/2002 6:26:00 AM
Hi Simeon,

> I am trying to think of a way to automatically generate numbers for
> the tabindex property of html anchors. Since the xml that ends up
> getting transformed into the anchor could be at any level within the
> document I can't use a simple position().

Try using xsl:number with level="any":

  <xsl:number level="any" />

That will get you a number for the <a> element amongst *all* the other
<a> elements in the document. If you want to narrow that down, you can
use the 'count' attribute, to for example only count those <a>
elements that have an 'id' attribute:

  <xsl:number level="any" count="a[@id]" />

These are essentially the same as:

  <xsl:value-of select="count(preceding::a) + 1" />

and:

  <xsl:value-of select="count(preceding::a[@id]) + 1" />

respectively.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.