The
XML Path Language (XPath) is an XSL sub-language designed to uniquely
identify
or address parts of a source XML document. An XPath expression can
be used
to search through an XML document, and extract information from the
nodes
(any part of the document, such as an element or attribute) in it.
There are four different
kinds of XPath expressions:
- Boolean
- An
expression type with two possible values.
- Node set
- A collection of nodes that match an expression's
criteria, usually derived
with a location path.
- Number
- A
numeric value, useful for counting nodes and for performing simple
arithmetic.
- String
- A fragment
of text that can be from the input tree, processed or augmented
with general text.
An XPath expression returns
a certain node set, which is a collection of
nodes. For example, if you tell XPath to look for any element with
an id attribute,
there can be more than one. XPath returns a node set, which is a collection
of all the elements in the input document that have an id element.
A sample of an XPath expression:
/order/item/part-number
Which means "select any elements named part-number,
which are children of item elements, which are
children
of order elements which are children of the document
root.
You can create an XPath expression using
the XPath Expression
wizard. You can launch the XPath Expression wizard in the following
ways:
- From the pop-up menu of any select or match attributes
in an XSL file. Select the attribute, right-click it, and click XPath
Expression.
- From any of the XSL editor wizards
in which you can specify an XPath expression
for a field value. In the appropriate wizard, click the XPath button.