![](/images/new-backgrounds/1214202/214202165x1.webp)
Chapter 2 Building an XML model
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 | |
|
| ||
XSM User's Guide | 71 |