ZVON > Tutorials > XPointer Tutorial
>> Example 3 / 3 << | Prev | Next |
Contents > element() scheme > Combining ID and child sequence

Combining ID and child sequence

The child sequence starts at the element determined by ID, not from the root.

XPointer:element(b1/1)
Corresponding XPath:id('b1')/*[1]
Matches the first child of the element with ID "b1".

<!DOCTYPE   AAA
[
<!ELEMENT   AAA   (BBB+)>
<!ELEMENT   BBB   (CCC+)>
<!ATTLIST   BBB
                              id   ID   #REQUIRED>
<!ELEMENT   CCC   EMPTY>
]
>

<AAA>
   <BBB   id="b0">
      <CCC/>
      <CCC/>
   </BBB>
   <BBB   id="b1">
      <CCC/>
      <CCC/>
   </BBB>
</AAA>