Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Use</strong> (supposing the initial context node is either a <code>productCategory[genericName = 'DCinemaLens']</code> or a <code>productModel</code>):</p> <pre><code>../preceding-sibling::*[1] </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= "/*/*/productCategory [genericName = 'DCinemaLens'] /../preceding-sibling::*[1]"/&gt; ------------- &lt;xsl:text/&gt; &lt;xsl:copy-of select= "/*/*/*/*/productModel/../preceding-sibling::*[1]"/&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;productCategory&gt; &lt;genericName&gt;DigitalCinema&lt;/genericName&gt; &lt;productCategories&gt; &lt;productCategory&gt; &lt;genericName&gt;DCinemaProj&lt;/genericName&gt; &lt;productModels&gt; &lt;productModel&gt;ProjProd-1&lt;/productModel&gt; &lt;productModel&gt;ProjProd-2&lt;/productModel&gt; &lt;productModel&gt;ProjProd-3&lt;/productModel&gt; &lt;productModel&gt;ProjProd-4&lt;/productModel&gt; &lt;/productModels&gt; &lt;/productCategory&gt; &lt;productCategory&gt; &lt;genericName&gt;DCinemaLens&lt;/genericName&gt; &lt;/productCategory&gt; &lt;/productCategories&gt; &lt;/productCategory&gt; </code></pre> <p><strong>the wanted two elements are copied to the output</strong>:</p> <pre><code>&lt;genericName&gt;DigitalCinema&lt;/genericName&gt; ------------- &lt;genericName&gt;DCinemaProj&lt;/genericName&gt; </code></pre>
    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. 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