|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: uniqueID(), childNumber(), and formatIndex()
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








