Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Use</strong>:</p> <pre><code> //td[translate(substring(text()[1], string-length(text()[1]) - 9), 'COUNTRY :', 'country' ) = 'country' ] /span/text() </code></pre> <p><strong>XSLT - based verification</strong>:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output omit-xml-declaration="yes" indent="yes"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:copy-of select= "//td[translate(substring(text()[1], string-length(text()[1]) - 9), 'COUNTRY :', 'country' ) = 'country' ] /span/text() "/&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p><strong>When this transformation is applied on the provided XML document:</strong></p> <pre><code>&lt;html&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; Name of the Country : &lt;span&gt; USA &lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; Name of the country : &lt;span&gt; UK &lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/html&gt; </code></pre> <p><strong>the XPath expression is evaluated and the selected two text-nodes are copied to the output:</strong></p> <pre><code> USA UK </code></pre> <p><strong>Explanation</strong>:</p> <ol> <li>We use a specific variant of the XPath 1.0 expression that implements the XPath 2.0 standard function <code>ends-with($text, $s)</code>: this is: </li> </ol> <p>.....</p> <pre><code>$s = substring($text, string-length($text) - string-length($s) +1) </code></pre> <p>.2. The next step is, using the <code>translate()</code> function, to convert the ending 10-character long string to lowercase, eliminating any spaces or any ":" character.</p> <p>.3. If the result is the string (all lowercase) "country", then we select the children text nodes (only one in this case) of the s=<code>span</code> child of this <code>td</code>.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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