XPath in XSLT

Welcome to our free XML tutorial. This tutorial is based on Webucator's Introduction to XML Training course.

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.

Syntax

<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.

Syntax

<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.

Next

This tutorial is based on Webucator's Introduction to XML Training Course. We also offer many other XML Training courses. Sign up today to get help from a live instructor.