Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using the XPath is simple and straightforward, you have to filter elements olny. Your filtring could be based on the content of the element (using <code>[]</code> and path inside the brackets). With the filtered elements you can work as same as with the XML tree (start filtering again or select the final elements).</p> <p>In your case, first you have to choose the correct <code>tc</code> element (filter the element as you need):</p> <ul> <li>Based on the count of elements: <code>//tc[count(./p/*) = 1]</code>, or</li> <li>Based on non existing <code>r</code> element: <code>//tc[not(./p/r)]</code>, or</li> <li>Based on non existing <code>r</code> and <code>hyperlink</code> element: <code>//tc[not(./p/r) and not(./p/hyperlink)]</code></li> <li>Based on existing <code>pPr</code> and non existing <code>r</code> (it is not a necessary because the <code>pPr</code> is filtred in second step): <code>//tc[./p/r and not(./p/r)]</code></li> </ul> <p>It returns the following XML.</p> <pre><code>&lt;tc&gt; &lt;p&gt; &lt;pPr&gt;pPr&lt;/pPr&gt; &lt;/p&gt; &lt;/tc&gt; </code></pre> <p>Then just simply say what do you want from the new XML:</p> <ul> <li>Do you want the <code>pPr</code> element? Use: <code>/p/pPr</code></li> </ul> <p>All together:</p> <pre><code>//tc[count(./p/*) = 1]/p/pPr </code></pre> <p>or </p> <pre><code>//tc[not(./p/r)]/p/pPr </code></pre> <p><strong>Note</strong>: <code>//</code> means find the element anywhere in the document.</p> <p><strong>Update 1</strong>: Hyperlink condition added.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload