Section 17.3.  Children and descendants

Prev don't be afraid of buying books Next

17.3. Children and descendants

The /book/chapter/figure/caption expression addresses two elements with no children other than data. The expression /book/chapter/figure, however, addresses the figure elements with their caption children, as shown in Example 17-3.

Example 17-3. Figure elements with their caption children
 <figure picfile="one.jpg">   <caption>The first figure's caption</caption> </figure> <figure picfile="two.jpg">   <caption>The second figure's caption.</caption> </figure> 

The location path /book addresses the entire document.

In a location path, the slash character (/) means "child of". A double slash (//) means "descendant of," which is more flexible as it includes children, grandchildren, great-grandchildren, and so on. For example, /book//caption addresses any caption element descended from a book element. In the book shown in Figure 17-2 it would address the example element's caption from the book's second chapter along with the figure elements' two caption elements:

Example 17-4. Caption elements descended from the book element
 <caption>The first figure's caption</caption> <caption>The second figure's caption.</caption> <caption>The first example.</caption> 

Amazon


XML in Office 2003. Information Sharing with Desktop XML
XML in Office 2003: Information Sharing with Desktop XML
ISBN: 013142193X
EAN: 2147483647
Year: 2003
Pages: 176

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