September 2004
Intermediate to advanced
712 pages
24h 45m
English
An abbreviated syntax is available for particularly common location steps. In this syntax, five axes may use this shorthand:
The context node
..The parent node
nameThe child element or elements with the specified name
//All descendants of the context node, and the context node itself
@
nameThe attribute of the context node with the specified name
Using the abbreviated syntax, the previous examples can be rewritten in the following manner:
set
.//.
ancestor-or-self::*
@xlink:href
set[position( )=2]
.//.[.='Eunice']
ancestor-or-self::*[position( )=2][.="Celeste"]
@xlink:href[starts-with('http')]
ancestor-or-self::*/*[position( )=1]
document/set[position( )=2]/following-sibling::*
.//.[.='Eunice']/@ID
//ship/ancestor-or-self::*/*[position( )=1]
/document/set[position( )=2]/following-sibling::*
/descendant::node( )[.='Eunice']/@ID
set | ./*//vector | ancestor::* | @hrefNot all location steps can be rewritten using the abbreviated
syntax. In particular, only the child, self, attribute, descendant-or-self, and parent axes can be abbreviated. The
remaining axes must be spelled out in full.