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> |