title: Modify element based on subelement's partial value via xsl
body: <p>I have the follow XML 1.0 code</p>
  
  <pre><code>&lt;oldEle userlabel="label1"&gt;
      &lt;ele1&gt;%02d.jpeg&lt;/ele1&gt;
  &lt;/oldEle&gt;
  
  &lt;oldEle userlabel="label2"&gt;
      &lt;ele1&gt;%02d.tiff&lt;/ele1&gt;
  &lt;/oldEle&gt;
  </code></pre>
  
  <p>I want to change the oldEle to jpeg and tiff for each oldEle using xsl v1.0. Essentially I want xsl to do this:</p>
  
  <pre><code>&lt;JPEG userlabel="label1"&gt;
      &lt;ele1&gt;%02d.jpeg&lt;/ele1&gt;
  &lt;/JPEG&gt;
  
  &lt;TIFF userlabel="label2"&gt;
      &lt;ele1&gt;%02d.tiff&lt;/ele1&gt;
  &lt;/TIFF&gt;
  </code></pre>
  
  <p>I have tried the following but it is not working:</p>
  
  <pre><code>&lt;xsl:template match="/oldEle"&gt;
      &lt;xsl:for-each select="/oldEle"&gt;
      &lt;xsl:if test="contains(/oldEle/ele1,'jpeg')"&gt;
          &lt;JPEG&gt;
            &lt;xsl:apply-templates select="@*|node()"/&gt;
          &lt;/JPEG&gt;      
      &lt;/xsl:if&gt;      
      &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Thanks!</p>