You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/10/14 18:10:31 UTC

DO NOT REPLY [Bug 23817] New: - Redirect produces duplicate document type declaration

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23817>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23817

Redirect produces duplicate document type declaration

           Summary: Redirect produces duplicate document type declaration
           Product: XalanJ2
           Version: 2.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.processor
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: mat@big-badger.co.uk


Input XML:

<?xml version="1.0" encoding="UTF-8"?>
<site-map>
  <pages>
    <page>
      <id>page-1</id>
    </page>
    <page>
      <id>page-2</id>
    </page>
  </pages>
</site-map>

XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:redirect="http://xml.apache.org/xalan/redirect"
                extension-element-prefixes="redirect">
    
  <xsl:output
     method="html"
     version="4.01"
     indent="yes"
     encoding="UTF-8"
     doctype-system="http://www.w3.org/TR/html4/strict.dtd"
     doctype-public="-//W3C//DTD HTML 4.01//EN"
  />
  
  <xsl:template match="/">
    <xsl:apply-templates select="//page"/>
  </xsl:template>
  
  <xsl:template match="page">
    <redirect:write select="concat(id, '.html')">
      <HTML lang="en">
        <BODY>
          <xsl:value-of select="id"/>
        </BODY>
      </HTML>
    </redirect:write>
  </xsl:template>

</xsl:stylesheet>

Produces these output files:

cat page-1.html 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML lang="en">
<BODY>page-1</BODY>
</HTML>

cat page-2.html 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML lang="en">
<BODY>page-2</BODY>
</HTML>

Note the two doctype tags.

This bug seems to of appeared between Xalan versions 2.4.1 and 2.5.1.

I'm working round the bug at the moment by passing the output through sed to
remove the first line.