Changes between Initial Version and Version 1 of XPath selection in Arboreal (examples)


Ignore:
Timestamp:
Oct 21, 2009, 10:06:59 AM (15 years ago)
Author:
kthoden
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • XPath selection in Arboreal (examples)

    v1 v1  
     1{{{
     2#!html
     3<h1>Some XPath examples</h1>
     4
     5<p>These examples illustrate some potentially useful applications of
     6the <b>Select XPath</b> feature (under the <b>Edit</b> menu) in
     7Arboreal, when working with Archimedes Project texts.</p>
     8
     9<p class="example">Find all heads:</p>
     10<ul>
     11<li><code>//p[@type='head']//s[1]</code>
     12</ul>
     13
     14<p class="example">Find all figures in the third chapter:</p>
     15<ul>
     16<li><code>//chap[3]//figure</code>
     17</ul>
     18
     19<p class="example">Find the sixth and seventh sentences in each paragraph:</p>
     20
     21<ul>
     22<li><code>//p/s[position()>=6 and position()&lt;=7]</code>
     23</ul>
     24
     25<p class="example">Select all paragraphs containing three sentences:</p>
     26<ul>
     27<li><code>//p[count(.//s)=3]/descendant-or-self::*</code>
     28</ul>
     29
     30<p class="example">Select all figures with no place attribute:</p>
     31<ul>
     32<li><code>//figure[not(@place)]</code>
     33
     34</ul>
     35
     36<p class="example">Select all elements with more than three attributes:</p>
     37<ul>
     38<li><code>//*[count(@*)>=3]</code>
     39</ul>
     40}}}