One common way to identify an
element in an XML document is by location. Identifying an
element by location is generally accomplished by counting children down from the
root. For example, the following XPointer points to John P. Muller's
PERSON
element:
/child::*[position()=1]/child::*[position()=4]
A tumbler is a shortcut for XPointers exemplified by the second example above; that is, an XPointer that consists of nothing but a series of child relative location steps counting down from the root node, each of which selects a particular child by position only. The shortcut is to use only the position number and the slashes that separate individual elements from each other, like this:
http://www.harolds.net/genealogy.xml#/1/4
/1/4
is a tumbler that says to select the fourth child element of the first child element of the root. This syntax can be extended for any depth of child elements. For example these two URIs point to John P. Muller's NAME
and SPOUSE
elements respectively:
http://www.harolds.net/genealogy.xml#/1/4/1
http://www.harolds.net/genealogy.xml#/1/4/2
Each tumbler always points to a single element. You cannot use tumblers with any other relative location steps. You cannot use them to select elements of a particular type. You cannot use them to select attribute or strings. You can only use them to select a single element by its relative location in the tree.