XPath in XSLT

Contact Us or call 1-877-932-8228
XPath in XSLT

XPath in XSLT

To do anything significant with XSLT, you must work with the XML Path Language (XPath). XPath is a W3C Recommendation that is used for identifying elements, attributes, text and other nodes within an XML document. XPath looks at an XML document as a tree. Each element is a branch that may have branches of its own.

In XSLT, XPath is used to match nodes from the source document for output templates via the match attribute of the xsl:template tag.

<xsl:template match="SOME_XPATH">

XPath is also used in the xsl:value-of tag to specify elements, attributes and text to decide what to output.

<xsl:value-of select="SOME_XPATH"/>

In addition, XPath is used in conditionals and flow control statements, which is covered in the lesson on Flow Control.