A second numeric argument targets a particular position in the string. For example, this targets whatever immediately follows the first occurrence of the string "Harold" because Harold has six letters:
xptr(/string::"Harold",6[position()=1])
An optional third number specifies the number of characters to select. For example, this URI selects the first occurrence of the entire string "Harold":
xptr(/string::"Harold",1,6[position()=1])
If the first string argument in the node test is the empty string, then relevant positions in the context node's text contents will be selected. For example, this XPointer targets the first six characters of the document:
xptr(/string::"",1,6[position()=1])
When matching strings, case is considered. White space is condensed to a single space. Markup characters are ignored.
The most common use of the string axis is to select part of the text
contents of a node previously selected by more conventional means, rather than
to pick an absolute location in the document. For example, this selects the
month in the first BORN
element:
/descendant::BORN[position()=1]/string::" ",2,3[position() = 1]