[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] uniqueID(), childNumber(), and formatIndex()
Subject: Re: [xsl] uniqueID(), childNumber(), and formatIndex() From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Tue, 2 Jan 2001 18:37:46 +0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] uniqueID(), childNumber(), an, John Cartwright | Thread | [xsl] Sibling Axes, Adam Van Den Hoven |
Re: [xsl] Conditional Formating, Jeni Tennison | Date | RE: [xsl] Sorting times in xslt, Kay Michael |
Month |