current Function
Returns a node set that has the current node as its only member.
node-set current()
Parameters
None.
Return Values
Returns a node set that has the current node as its only member.
Remarks
The function returns a node set that has the current node as its only member. For an outermost expression, an expression not occurring within another expression, the current node is always the same as the context node; thus
<xsl:value-of select="current()"/>
is the same as the following code.
<xsl:value-of select="."/>
However, within square brackets, the current node is usually different from the context node, as shown in the following example.
<xsl:apply-templates select="//glossary/item[@name=current()/@ref]"/>
processes all <item> elements that have a <glossary> parent element and a name attribute with value equal to the value of the current node's ref attribute. This is different from
<xsl:apply-templates select="//glossary/item[@name=./@ref]"/>
which means the same as the following code.
<xsl:apply-templates select="//glossary/item[@name=@ref]"/>
This code would process all <item> elements that have a <glossary> parent element and that have a name attribute and a ref attribute with the same value.
Requirements
None.
See Also
Last updated on Saturday, April 10, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.