title: How does the DOCTYPE declared as DTD influence XSLT transformation?
body: <p>I am transforming a TEI encoded text document (TEI - Text Encoding Initiative, a standard in text document encoding), using XSLT 1 and 2 and various processors. </p>
  
  <p>I am experiencing a very peculiar problem. Depending on which DTD I supply in the header of the XML file I get different results. An example input file: 
      </p>
  
  <pre><code>&lt;!DOCTYPE TEI SYSTEM "tei_lite.dtd"&gt;
  &lt;TEI&gt;
    &lt;teiHeader&gt;  
      &lt;fileDesc&gt;
        &lt;titleStmt&gt;
          &lt;title&gt;Przyjaciel szczery&lt;/title&gt;
          &lt;author&gt;Jan Daniecki&lt;/author&gt;
          &lt;respStmt&gt;
            &lt;resp&gt;wyd.&lt;/resp&gt; 
            &lt;name&gt;Maciej Eder&lt;/name&gt;
          &lt;/respStmt&gt;
        &lt;/titleStmt&gt;
      &lt;/fileDesc&gt;
     &lt;/teiHeader&gt;
  &lt;/TEI&gt;
  </code></pre>
  
  <p>The following xslt should DELETE the author node:</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
    &lt;xsl:template match="author"/&gt;
    &lt;xsl:template match="*"&gt;
      &lt;xsl:copy&gt;
        &lt;xsl:apply-templates /&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>However, the stylesheet ONLY deletes the node if I replace the dtd (which would be too long to post here) with an empty one.</p>
  
  <p>I found out why: it's because using the DTD introduces a namespace. For the stylesheet to work, it turns out, I need to declare the namespace - then everything works, see</p>
  
  <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:tei="http://www.tei-c.org/ns/1.0" version="2.0"&gt;
    &lt;xsl:template match="tei:author"/&gt;
    &lt;xsl:template match="*"&gt;
      &lt;xsl:copy&gt;
        &lt;xsl:apply-templates /&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I thought that only default attribute nodes are affected by the DTD definition during XSLT transformation. Could someone summarize how and when the DTD adds namespaces that need to be accounted for? </p>
  
  <p>Thanks!</p>