[xsl] saxon:output doctype inherits xsl:output doctype

Subject: [xsl] saxon:output doctype inherits xsl:output doctype
From: "Bob Stayton" <bobs@xxxxxxxxxxxx>
Date: Mon, 2 Oct 2006 17:24:18 -0700
Perhaps this has come up before, but I couldn't find it in the archives.

I have an XSL stylesheet that I'm processing with Saxon 6.5.5. It's xsl:output includes doctype-public and doctype-system to generate XHTML output with a correct DOCTYPE declaration. In the stylesheet I'm also using the extension element saxon:output to generate a separate XML file that is not XHTML, and should actually have no DOCTYPE declaration because it is intended to be used as a system entity file.

I have found that saxon:output seems to inherit the doctype-public and doctype-system from the xsl:output element. If my separate file had its own doctype, I could override those by specifying the attributes on saxon:output. But I need to it to have no DOCTYPE. I've tried every combination I could think of, but I can't turn off the inherited doctype-public and doctype-system inherited from the xsl:output element of the stylesheet.

Here is a boiled down stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
               xmlns:saxon="http://icl.com/saxon";
               extension-element-prefixes="saxon"
               exclude-result-prefixes="saxon"
               version="1.0">

<xsl:output method="xml" doctype-public="FOO" doctype-system="BAR"/>

<xsl:template match="/*">
 <section>
   <xsl:apply-templates/>
 </section>
 <saxon:output href="side.out">
   <appendix>
     <xsl:apply-templates/>
   </appendix>
 </saxon:output>
</xsl:template>

</xsl:stylesheet>

With this small sample input file:

<?xml version="1.0"?>
<text>Some text</text>

The main output file has the doctypes from xsl:output:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE section
 PUBLIC "FOO" "BAR">
<section>Some text</section>

The side.out output file also has these doctypes:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE appendix
 PUBLIC "FOO" "BAR">
<appendix>Some text</appendix>

If I change the stylesheet to use:

<saxon:output href="side.out" doctype-public="" doctype-system="">

Then the side.out contains:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE appendix
 PUBLIC "" "">
<appendix>Some text</appendix>

Is there any way to tell saxon:output to not inherit from xsl:output?

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@xxxxxxxxxxxx

Current Thread