Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

XSLT Context (Dot) Overview

The current context node changes as an <xsl:apply-templates> instruction traverses the document hierarchy and as an <xsl:for-each> instruction examines each node that matches an XPath expression. All relative node references are relative to the current context node. This node is abbreviated “ .” (read: dot) and can be referred to in XPath expressions, allowing explicit references to the current node.

The following example contains four uses for “.” . The system node is saved in the system variable for use inside the <xsl:for-each> instruction, where the value of “.” will have changed. The for-each select expression uses “.” to mean the value of the name element. The “.” is then used to pull the value of the name element into the <tag> element. The <xsl:if> test then uses “.” to reference the value of the current context node.