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

Re: generating numbers for anchor tabindex

Subject: Re: generating numbers for anchor tabindex
From: Simeon Walker <simeon@xxxxxxxxxxxxxxxx>
Date: Sun, 06 Oct 2002 16:33:23 +0100
tabindex xsl
Hi,

thanks very much for that, I didn't realize what can be done with
xsl:number. My count attribute will be quite long since there are so
many things that end up getting transformed into anchors, but it's not
a problem.

Regards,
Simeon

Jeni Tennison wrote:
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

-- Simeon Walker, email: simeon@xxxxxxxxxxxxxxxx School of Biological Sciences, phone: +44 (0)1248 383702 University of Wales, Bangor, fax: +44 (0)1248 382569 Gwynedd, LL57 2UW, UK. www: http://biology.bangor.ac.uk/


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.