User manual

Chapter 2 Building an XML model
XSM User's Guide 71
XPath abbreviated syntax
You can use the following abbreviated syntax to define an XPath expression:
Syntax Description
/
Root node of the XML document. It is the root
element with its ramifications
.
Selects the context node. It is the current
element (on which an identity constraint is
defined) with its ramifications
..
Selects the context node parent
*
Selects all the child elements of the context
node
employee Selects all the employee child elements of the
context node
s:employee Selects all the employee child elements of the
context node, defined in the namespace with the
ā€œsā€ prefix
@numEmployee Selects the numEmployee attribute of the
context node
@* Selects all the attributes of the context node
../@numEmployee Selects the numEmployee attribute of the
context node parent
employee[1] Selects the first employee child element of the
context node
employee[last()] Selects the last employee child element of the
context node
*/employee Selects all the employee grandchildren of the
context node
//employee Selects all the employee descendants of the root
node
.//employee Selects the employee descendants of the context
node
company//employee Selects the employee descendants of the
company child elements of the context node
//company/employee Selects all the employee elements with company
as parent element in the context node