wiki:XPath selection in Arboreal (examples)

Some XPath examples

These examples illustrate some potentially useful applications of the Select XPath feature (under the Edit menu) in Arboreal, when working with Archimedes Project texts.

Find all heads:

  • //p[@type='head']//s[1]

Find all figures in the third chapter:

  • //chap[3]//figure

Find the sixth and seventh sentences in each paragraph:

  • //p/s[position()>=6 and position()<=7]

Select all paragraphs containing three sentences:

  • //p[count(.//s)=3]/descendant-or-self::*

Select all figures with no place attribute:

  • //figure[not(@place)]

Select all elements with more than three attributes:

  • //*[count(@*)>=3]
Last modified 15 years ago Last modified on Oct 21, 2009, 10:06:59 AM