Next / Previous / Contents / TCC Help System / NM Tech homepage

12. XSLT functions

In addition to the XPath functions defined above, XSLT supplies a number of additional functions.

12.1. current(): Return the current node

The current() function returns a node-set containing only the current (context) node. In most situations, this is exactly the same result as the XPath expression ".", but there is one case with a very important difference.

Recall that XPath expressions can have several levels of selection. For example, the XPath expression "park/tree" selects <park> children of the context node, and then it selects <tree> children of those nodes. So at each stage of evaluation of that XPath expression, "." has a different meaning: at each stage it means the set of nodes selected so far.

The critical difference in the current() function is that it always refers to the node that was the context node before any of the XPath expression was evaluated.