title: XSLT change/override attribute on copy-of not applied (using saxon )
body: <p>I have a xslt like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet xmlns:db="http://www.liquibase.org/xml/ns/dbchangelog"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"&gt;
    &lt;xsl:output method="xml"  indent="yes" /&gt;
    &lt;xsl:template match="/"&gt;    
        &lt;xsl:for-each select="db:databaseChangeLog/db:changeSet"&gt; 
            &lt;xsl:if test="name(*[1])='createTable'"&gt;  
            &lt;xsl:result-document  href="base/tables/{position()}_{name(*[1])}_{*[1]/@tableName}.xml"&gt;
             &lt;databaseChangeLog 
                  xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"&gt;
  
                  &lt;xsl:copy-of select="."/&gt;                       
  
                  &lt;xsl:copy-of select="../db:changeSet[name(*[1])='createIndex' and *[1]/@tableName= current()/*[1]/@tableName ]" /&gt;
  
              &lt;/databaseChangeLog&gt; 
          &lt;/xsl:result-document&gt;      
          &lt;/xsl:if&gt; 
        &lt;/xsl:for-each&gt;     
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match="@* | node()" mode="copy"&gt;
         &lt;xsl:copy&gt;
            &lt;xsl:apply-templates select="@* | node()"/&gt;
         &lt;/xsl:copy&gt;
     &lt;/xsl:template&gt;
  
      &lt;xsl:template match="db:changeSet/@author" mode="copy"&gt;
          &lt;xsl:attribute name="author"&gt;
              &lt;xsl:value-of select="'sakhunzai'"/&gt;
          &lt;/xsl:attribute&gt;
      &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <h1>XML partial file</h1>
  
  <pre><code>&lt;changeSet author="xxx (generated)" id="1358259674512-26"&gt;
          &lt;createIndex indexName="category_id" tableName="teams" unique="false"&gt;
              &lt;column name="audience_id"/&gt;
          &lt;/createIndex&gt;
  &lt;/changeSet&gt;
  &lt;changeSet author="xxx (generated)" id="1358259674512-29"&gt;
      &lt;createIndex indexName="id" tableName="users" unique="false"&gt;
          &lt;column name="id"/&gt;
          &lt;column name="career_lead_id"/&gt;
      &lt;/createIndex&gt;
  &lt;/changeSet&gt;
  </code></pre>
  
  <p>I want to override the attribute values of changeSet (author and id). Please help me fix the xslt. </p>
  
  <p>Everything is working fine but @author  atrribute value  is not change in target xml files 
  note: since xsltproc failed to do ,I switched to saxon java based processor e.g </p>
  
  <p><code>java -jar /usr/local/liquibase/saxon/saxon9he.jar  common.xml table.xslt</code></p>
  
  <h1><strong>Working XSLT</strong></h1>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet xmlns:db="http://www.liquibase.org/xml/ns/dbchangelog"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"&gt;
    &lt;xsl:output method="xml"  indent="yes" /&gt;
    &lt;xsl:template match="/"&gt;    
        &lt;xsl:for-each select="db:databaseChangeLog/db:changeSet[db:createTable]"&gt; 
            &lt;xsl:result-document  href="base/tables/{position()}_{name(*[1])}_{*[1]/@tableName}.xml"&gt;
             &lt;databaseChangeLog 
                  xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"&gt;
  
                  &lt;xsl:apply-templates select="." mode="copy"/&gt;                       
  
                  &lt;xsl:apply-templates select="../db:changeSet[db:createIndex and *[1]/@tableName= current()/*[1]/@tableName ]"  mode="copy"/&gt;
  
              &lt;/databaseChangeLog&gt; 
          &lt;/xsl:result-document&gt;
        &lt;/xsl:for-each&gt;     
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match="node()" mode="copy"&gt;
        &lt;xsl:copy&gt;
            &lt;xsl:attribute name="author"&gt;sakhunzai&lt;/xsl:attribute&gt;
             &lt;xsl:copy-of select="@id|node()"/&gt;
        &lt;/xsl:copy&gt;
     &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>