functions

 

In addition to the XPath functions defined above, XSLT supplies a number of additional functions.
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.
document(): Pull in content from other documents

There is one optional argument:

    document(uri)

where uri is the URI of a document. The return value is a node-set containing that document as a tree. If the argument is an empty string ('document("")'), you get back your own stylesheet (the one in which the document() call occurs) as a tree. This allows you to access content in another document (or your stylesheet) the same way you'd access the content of the input document: write template rules for that content and invoke it with xsl:apply-templates or xsl:call-template.

     current(): Return the current node
     document(): Pull in content from other documents
     format-number(): Convert a number to a string
     generate-id(): Generate a unique identifier
     key(): Refer to an index entry
     system-property(): Return a system property value