IBM Version 5 manual XPointer range functions

Models: Version 5

1 340
Download 340 pages 15.44 Kb
Page 47
Image 47

￿The node test is ROW

￿The predicate is [position()=34]

This example located the 34th ROW element along from the content node.

The user can also specify the absolute location steps that do not depend on the context node.

The location path of the XPointer is:

/child::BOEING747/child::ROW[position()=3].

This path is built from two location steps:

/child::BOEING747 and child::ROW[position()>34]

The first step is an absolute step that selects all child elements of the root node whose name is BOEING747. This should return to exactly one such element. The second step is then applied relative to the BOEING747 element returned by the first step. All of its child nodes are considered. Those that satisfy the node test, that is, elements whose name is ROW are returned. There might be 50 nodes. Therefore, all nodes from 35 to 50 are returned.

XPointer range functions

A range describes a contiguous part of a document. Location paths are identified by location paths. To specify a range, the user appends /range-to(end-point) to a location path specifying the start point of the range. An example would be:

xpointer(/child::BOEING747/child::ROW[position()=22]/range-to(/child::BOEING747 /child::ROW[position()=last()]))

Other range functions are:

range(location-set):Returns a set containing one range for each location specified the argument. It is the minimum range necessary to cover the entire location. In essence, it converts locations to ranges.

range-inside(location-set):Returns a set of locations inside the element with the start and end tags not included. If the input location is a range or point, than it points to that range or point.

start-point(location-set):Returns a set that contains the first point of each location in the input location set. For example, start-point(//ROW[1])returns the point immediately after the first <ROW> start tag in the document. start-point(//ROW)returns the set of points immediately after each <ROW> start tag.

Chapter 2. Technologies in XML 31

Page 47
Image 47
IBM Version 5 manual XPointer range functions