title: How to add attribute to a parent-node conditioned by a child element, with indentity-transform in XSLT1?
body: <p>Like in <a href="https://stackoverflow.com/q/18025375/287948">this other question</a> I have difficulty to express simple things with XSLT1...</p>
  
  <p>In a <code>xsl:stylesheet</code> I have this "identity like" transform to add an attribute <code>align="center"</code> into a <code>TD</code> tag with other attributes more (that must stay there)... The trigger for add <code>align</code> is the existence of a tag <code>CENTER</code> into the tag <code>TD</code>. (later the tag <code>CENTER</code> will be removed). </p>
  
  <pre><code>&lt;xsl:template match="@*|node()" name="identity"&gt;
    &lt;xsl:copy&gt;
      &lt;xsl:if test="name()='td'  and .//center"&gt;
                 &lt;xsl:attribute name="align"&gt;center&lt;/xsl:attribute&gt;
      &lt;/xsl:if&gt;
      &lt;xsl:apply-templates select="@*|node()"/&gt;
    &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt; 
  </code></pre>
  
  <p>THIS CODE DOES BOT WORK (<code>xsl:if</code> is ignored).</p>
  
  <hr>
  
  <p>Need <code>td//center</code>, not only <code>td/center</code> neither <code>td/p/center</code>. Must be generic, for any <code>td//center</code>. Example of input:</p>
  
  <pre><code>&lt;td colspan="2"&gt;
     &lt;p&gt;&lt;center&gt;POF&lt;/center&gt;&lt;/p&gt;
  &lt;/td&gt;
  </code></pre>