title: xslt select only elements with a given value
body: <p>This is my input:</p>
  
  <pre><code>&lt;div class="z"&gt;zzz
    &lt;div class="a"&gt;a1&lt;/div&gt;
    &lt;div class="b"&gt;b1
      &lt;div class="c"&gt;b1c1
        &lt;div class="d"&gt;b1c1d1&lt;/div&gt;
        &lt;div class="e"&gt;b1c1e1&lt;/div&gt;
        &lt;div class="f"&gt;b1c1f1&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="c"&gt;b1c2
        &lt;div class="d"&gt;b1c2d1&lt;/div&gt;
        &lt;div class="e"&gt;b1c2e1&lt;/div&gt;
        &lt;div class="f"&gt;b1c2f1&lt;/div&gt;
        &lt;div class="f"&gt;b1c2f2&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="b"&gt;b2
      &lt;div class="c"&gt;b2c1
        &lt;div class="d"&gt;b2c1d1&lt;/div&gt;
        &lt;div class="e"&gt;b2c1e1&lt;/div&gt;
        &lt;div class="e"&gt;b2c1e2&lt;/div&gt;
        &lt;div class="f"&gt;b2c1f1&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and this is the output I would like to get:</p>
  
  <pre><code>&lt;div class="z"&gt;zzz
    &lt;div class="a"&gt;a1&lt;/div&gt;
    &lt;div class="b"&gt;b1
      &lt;div class="c"&gt;b1c1
        &lt;div class="d"&gt;b1c1d1&lt;/div&gt;
        &lt;div class="e"&gt;b1c1e1&lt;/div&gt;
        &lt;div class="f"&gt;b1c1f1&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="c"&gt;b1c2
        &lt;div class="d"&gt;b1c2d1&lt;/div&gt;
        &lt;div class="e"&gt;b1c2e1&lt;/div&gt;
        &lt;div class="f"&gt;b1c2f1&lt;/div&gt;
        &lt;div class="f"&gt;b1c2f2&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>that is I would like to get:</p>
  
  <ul>
  <li>any text for div class="z", ie "zzz"</li>
  <li>any child that has class != "b" </li>
  <li>any child that has class="b" and value = "b1"</li>
  </ul>
  
  <p>I am using the following xslt:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &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:strip-space elements="*"/&gt;
  
   &lt;!-- Identity template, copies everything as is --&gt;
   &lt;xsl:template match="@*|node()"&gt;
    &lt;xsl:copy&gt;
     &lt;xsl:apply-templates select="@*|node()"/&gt;
    &lt;/xsl:copy&gt;
   &lt;/xsl:template&gt;
  
   &lt;xsl:template match="div[@class='z']"&gt;
     &lt;xsl:apply-templates select="div[@class='b' and text()='b1']" /&gt;
   &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>but unfortunately my output is empty :(</p>
  
  <p>What did I do wrong?</p>
  
  <p>Thank you for all your help.</p>