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

Re: uniqueID(), childNumber(), and formatIndex()

Subject: Re: uniqueID(), childNumber(), and formatIndex()
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 2 Jan 2001 18:37:46 +0000
childnumber this
Hi John,

> I have run across three functions uniqueID(), childNumber(), and
> formatIndex() that seem to be giving problems and I can't find
> descriptions for them.

There are descriptions in the MSXML SDK that you can download from
msdn.microsoft.com.

> <xsl:attribute name="HREF">#
>    <xsl:eval>uniqueID(this)</xsl:eval>
> </xsl:attribute>

You can replace this with:

<xsl:attribute name="HREF">
  <xsl:text>#</xsl:text>
  <xsl:value-of select="generate-id()" />
</xsl:attribute>

or (assuming this attribute is on an 'A' element):

<A HREF="#{generate-id()}">
  ...
</A>

> Distributor 
> <xsl:eval>formatIndex(childNumber(this), "1")</xsl:eval>

I think that the formatIndex is completely superfluous here, but you
can use format-number() in its place if not.

In most cases, I think this will be equivalent to:

<xsl:value-of select="position()" />

But it depends on the context as the position() function works out the
position of the current node based on the context node list, which
could be anything.  A safer equivalent would be:

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

This counts the number of preceding siblings to give the index of the
node within its parent's children.

I hope that helps,

Jeni

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



 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.