title: What is wrong with this xslt?
body: <p>Data file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&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;changeSet &gt;
        ...
      &lt;/changeSet&gt;
      &lt;changeSet &gt;
        ...
      &lt;/changeSet&gt;
  &lt;/databaseChangeLog&gt;
  </code></pre>
  
  <p>xslt</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
    &lt;xsl:output method="xml" indent="yes"/&gt;
    &lt;xsl:template match="/"&gt;    
        &lt;xsl:for-each select="databaseChangeLog/changeSet"&gt;       
          &lt;top&gt;  
           &lt;xsl:copy-of select="*"/&gt;      
          &lt;/top&gt; 
        &lt;/xsl:for-each&gt;   
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>using <code>xsltproc</code> tool :</p>
  
  <pre><code>xsltproc input.xslt  input.xml
  </code></pre>
  
  <p>outputs nothing. </p>
  
  <p>What is wrong with my xslt ? </p>
  
  <p><strong>final working table.xslt:</strong></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="1.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: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;/databaseChangeLog&gt; 
          &lt;/xsl:document&gt; 
        &lt;/xsl:for-each&gt;     
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p><strong>note:</strong> this splits the changelog (liquibase generateChangeLog output ) into its individual change 
  log files </p>
  
  <p><code>xsltproc table.xslt liquibase.changelog.xml</code></p>
  
  <p>This is successfully generating one file per changeSet in log file . (My next goal is to group changesets that are on single table , but that is out of the scope of this question)</p>
  
  <p>In case you are wondering what I am doing. </p>
  
  <p>Liquibase migration tools generates a single change log file for existing db. I was experimenting to split that output into separate log file for each table/object (specifically mysql)</p>