32 The XML Files: Develo pment of XML/XSL A pplications Using WebS phere Studio
end-point(location-set) - acts the same as start-point() but returns the points
just after each location in its input.
XPointer string functions
There are some basic string matching capabilities t hrough this function:
string-range() - It takes a location set to search and a substring to search for.
The result is a location set having a single range. The index and length
arguments specify the number of characters where the match should start from
and the number of characters it should search for. Strings to be searched for are
case sensitive. Markup characters are ignored.
The basic syntax is:
string-range(location-set, substring, index, length)
The first argument is a location from which the document to be searched for the
matching string. The second argument is the actua l string to search for. The
index argument must be a positive number to start after the beginning of the
match. The length argument can specify how many characters to include in the
range. If the last two arguments are not specified, then all characters are
assumed to require processing.
This example finds all occurrences of the string Boeing767:
xpointer(string-range(/,"Boeing767"))
The first argument can specify what nodes you want to look in. For example, this
finds all occurrences of the string Boeing767 in the UNITED elements:
xpointer(string-range(//UNITED,"Boeing767"))
This example finds only the first occurrence of the string Boeing737 in the
document:
xpointer(string-range(/,"Boeing737")[position()=1])
This final position is immediately before the word Boeing737 in the documents
UNITED element. This is not the same as pointing at the entire UNITED element as
an element-based selector would do.
A third argument, which is numeric, targets a particular position within the string.
This example targets the point between the l and g in the first occurrence of the
string Boeing737 because g is the sixth letter:
xpointer(string-range(/,"Boeing737",6)[position()=1])