[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] saxon:output doctype inherits xsl:output doctype
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 3 Oct 2006 08:47:41 +0100

I don't think there's a solution to this, though it's so long since I worked
with Saxon 6.5.5 that I may have forgotten something. I'd suggest moving to
Saxon 8.x and xsl:result-document, which gives you much more control; you're
also on much more secure ground using a standard XSLT 2.0 feature rather
than a vendor extension in a 1.0 product that isn't being developed any
further.

(The issue here is that doctype-system and doctype-public, unlike other
serialization attributes, have no way to specify the default value "absent"
by means of explicit syntax. The problem still exists in 2.0 with
xsl:result-document, but you can avoid it by using named output
definitions). 

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Bob Stayton [mailto:bobs@xxxxxxxxxxxx] 
> Sent: 03 October 2006 01:24
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] saxon:output doctype inherits xsl:output doctype
> 
> 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
Keywords