This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5893 - [XSLT 2.0] Allow explicit setting of doctype-system and doctype-public to null
Summary: [XSLT 2.0] Allow explicit setting of doctype-system and doctype-public to null
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Henry Zongaro
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-22 23:57 UTC by Michael Kay
Modified: 2009-01-30 12:14 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2008-07-22 23:57:34 UTC
In a number of cases with XSLT, and in further cases with external APIs, we define that one way of setting serialization parameters should override values that would otherwise be set in a different way. For example, this happens when one xsl:output declaration overrides another by having higher import precedence, and in the JAXP API an external setting of a serialization parameter can override a setting within a stylesheet. This will also affect XQuery once we have syntax for setting serialization parameters within a query.

Most of the time this works fine, but there is a problem with the two parameters doctype-system and doctype-public because they have no explicit value that is equivalent to leaving the parameter unspecified. This means it is not possible to override an explicit value with a "null" value.

It is proposed that we should permit the special value "#none" for both these parameters, this value being equivalent to leaving the parameter unspecified, except that it overrides any existing value for the parameter set in an interface that has lower precedence.
Comment 1 Michael Kay 2008-08-01 08:55:41 UTC
I'm reclassifying this as an XSLT problem. In fact, I'm classifying it as XSLT 2.0 on the basis that there is a facility in the serialization spec that XSLT 2.0 cannot fully exploit. The serialization spec *does* define that doctype-public or doctype-system can be set to "absent", the problem is that XSLT provides no surface syntax for setting this option.

I would like to suggest an erratum along the following lines: that in xsl:output and also in xsl:result-document, the value "" (a zero-length string) for doctype-system or doctype-public maps to the setting described in the Serialization spec as "absent", with the same effect as if the attribute were not specified, except that it overrides any other value for the attribute that would otherwise take effect.

We could generalize this and apply the same rule to all attributes of xsl:output and xsl:result-document: a setting of "" is equivalent to omitting the attribute except that it overrides any other setting.
Comment 2 Jirka Kosek 2008-10-02 07:49:07 UTC
(In reply to comment #1)

> I would like to suggest an erratum along the following lines: that in
> xsl:output and also in xsl:result-document, the value "" (a zero-length string)
> for doctype-system or doctype-public maps to the setting described in the
> Serialization spec as "absent", with the same effect as if the attribute were
> not specified, except that it overrides any other value for the attribute that
> would otherwise take effect.

This can clash with HTML5. One of proposals on the table was to allow 

<!DOCTYPE HTML PUBLIC "">

as an alternative HTML5 !DOCTYPE which can be currently emitted by using:

<xsl:output method="html" doctype-public=""/>

The latest HTML5 WG uses "XSLT-compat" instead of empty string "", but this can change.

But if we at the same time can say that <xsl:output method="html" version="5"/> will result in <!DOCTYPE HTML> then there is no need to reserve "" for potential use by HTML5.

Comment 3 Michael Kay 2008-10-23 14:28:08 UTC
Although the WG expressed some doubts about whether this was an appropriate change for an erratum, I was asked to draft text so that the proposal could be evaluated in detail. (Action A-2008-10-09-002)

1. In section 20, in the bullet points after the paragraph "The other attributes on xsl:output provide parameters for the output method. ", change the list items describing doctype-system and doctype-public to replace "By default, the parameter is not supplied":

"The attribute value "" (a zero-length string) denotes the parameter value "absent", that is, an indication that there should be no system identifier [resp. public identifier] in the DTD of the output document. This has the same effect as omitting the attribute; however, the explicit value "" may be used to override a different value in an xsl:output declaration with lower import precedence."

2. In section 19.1, xsl:result-document, add to the Note that starts "In the case of the attributes method, cdata-section-elements, and use-character-maps, ", a second paragraph reading:

"In the case of the attributes doctype-system and doctype-public, supplying a value of "" (a zero-length string) causes the corresponding serialization parameter to be absent; this overrides any explicit value for doctype-system or doctype-public in the selected output definition."
Comment 4 Jirka Kosek 2008-10-27 13:32:30 UTC
(In reply to comment #3)

> "The attribute value "" (a zero-length string) denotes the parameter value
> "absent", that is, an indication that there should be no system identifier
> [resp. public identifier] in the DTD of the output document. This has the same

I have to say that it is not clear to me what will be output of 

<xsl:output method="html" doctype-public=""/>

then. Will there be no !DOCTYPE at all, or HTML5 friendly <!DOCTYPE HTML>?

Thanks for clarification.
Comment 5 Michael Kay 2008-10-27 13:41:14 UTC
>I have to say that it is not clear to me what will be output of 

<xsl:output method="html" doctype-public=""/>

The essence of this proposal is that this will be identical to

<xsl:output method="html"/>

That is, setting the attribute to "" is the same as omitting it.

I don't actually know what the answer to your question is without reading the serialization spec in detail, but I don't think that's relevant.
Comment 6 Michael Kay 2009-01-30 12:14:09 UTC
As agreed by the XSL WG on 2009-01-29, erratum E31 has been drafted with the effect that supplying doctype-system="" or doctype-public="" on xsl:output or xsl:result-document indicates that the corresponding serialization parameter should not be set (should be "absent").

This bug will accordingly be marked fixed and closed.