title: Selecting files to be processed by XSLT stylesheet
body: <p>I have a group of XML files but I want to process only some of them. Not sure this is possible using XSLT, but is there a way to select via the stylesheet which files to process? For instance, I want to avoid creating a copy of files that don't match the XPath expression <code>//terms:identifier[text()='someID']</code>.</p>
  
  <p>Sample XML:</p>
  
  <pre><code>   &lt;root&gt;
      &lt;wrapper xmlns:terms="http://terms.example.com"&gt;
        &lt;terms:trid&gt;somevalue&lt;/terms:trid&gt;
        &lt;terms:identifier&gt;someID&lt;/terms:identifier&gt;
        &lt;foo:bar&gt;somevalue&lt;/foo:bar&gt;
      &lt;/wrapper&gt;
     &lt;/root&gt;
  </code></pre>
  
  <p>I tried the following but I get empty 'copies' of unwanted files.</p>
  
  <pre><code>&lt;xsl:template match="@*|node()"&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="//terms:identifier[text()='someID']" /&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*|node()" /&gt;
        &lt;/xsl:copy&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;
  </code></pre>