11.4 Child Sequences

     

Another very common form of XPointer is one that descends exclusively along the child axis, selecting elements by their positions relative to their siblings. For example, xpointer(/child::*[position( ) = 1]/child::*[ position( ) = 2]/child::*[position( ) = 3]) selects the third child element of the second child element of the root element of the document. The element( ) scheme allows you to abbreviate this syntax by providing only the numbers of the child elements separated by forward slashes . This is called a child sequence . For example, the previous XPointer could be rewritten using the element scheme in the much more compact form element(/1/2/3) .

For example, the aforementioned Motivation and Summary section of the "Namespaces in XML" recommendation at http://www.w3.org/TR/1999/REC-xml-names-19990114/xml- names .xml is given as a div element. It so happens that this div element is the first child element of the second child element of the root element. Therefore, http://www.w3.org/TR/1999/REC-xml-names-19990114/xml-names.xml#element(/1/2/1) points to this section.



XML in a Nutshell
XML in a Nutshell, Third Edition
ISBN: 0596007647
EAN: 2147483647
Year: 2003
Pages: 232

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net