Does anyone know of a list of XSLT instructions/functions that change the context node?
For example, instruction like for-each
is one of them.
Thus, XSLT processors model an XML document as a tree that contains seven kinds of nodes: The root. Elements. Text.
XSLT considers an XML file to consist of a tree of nodes , in which each element, attribute, and string of text contained in an element is a node. Each attribute of an element is a child node of that element's node; each child element is also a child node of that element's node.
A context node is the node the XPath processor is currently looking at. The context node changes as the XPath processor evaluates a query. If you pass a document to the XPath processor, the root node is the initial context node.
The obvious XSLT 2.0 instructions that change the context are for-each
, apply-templates
, for-each-group
, and analyze-string
. But there's also, for example, xsl:sort
and xsl:key
.
In XPath, the operators /
and []
change the context. There are no functions that change the context.
There are only two things in XSLT 1.0 that change the context and neither of them are functions. These are:
<xsl:apply-templates select='some-test'/>
(which will lead to the selected nodes being processed, each one becoming the context node as it is processed)
and
<xsl:for-each select='some-test'/>
In XSLT 2.0, you also have
<xsl:for-each-group/>
(which sets the context node in slightly more complex way than xsl:apply-templates
and xsl:for-each
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With