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 9778 - [SER] HTML output and namespace undeclaration
Summary: [SER] HTML output and namespace undeclaration
Status: CLOSED WONTFIX
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Serialization 1.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: 2010-05-20 09:57 UTC by Tim Mills
Modified: 2010-07-08 12:46 UTC (History)
0 users

See Also:


Attachments

Description Tim Mills 2010-05-20 09:57:23 UTC
Suppose an XQuery processor which supports XML Names 1.1 attempts to serialize the results of the following query as HTML:

<html>
  <body>
    <my:island  xmlns:my="ns1" xmlns:dummay="dummy">
      <my:child xmlns:dummy="" />
    </my:island>
    <p xmlns:foo="ns2">
      <strong xmlns:foo="">Will the undeclaration appear?</strong>
    </p>
  </body>
</html>

Will the namespace undeclaration xmlns:dummy="" be in the output or not?
Will the namespace undeclaration xmlns:foo="" be in the output or not?

The specification states that:

"The HTML output method MUST NOT output an element differently from the XML output method unless the expanded QName of the element has a null namespace URI."

However, the way in which the serialization of namespace undeclarations is determined is by the "version" and "undeclare-prefixes" serialization parameters.  Note that the "undeclare-prefixes" serialization parameter is specified to have no effect in HTML output mode.

My presumption is that namespace undeclarations in HTML are treated as if "undeclare-prefixes" was "no", but I can't see anything in the specification to confirm this.

I admit that this is a contrived example!
Comment 1 Henry Zongaro 2010-05-20 13:51:31 UTC
I believe that no undeclaration of namespace prefixes will occur.

In the first item in the numbered list of section 7.1,[1] the Serialization Recommendation says, "If the result tree contains namespace nodes for namespaces other than the XML namespace, the HTML output method MUST represent these namespaces using attributes named xmlns or xmlns:prefix in the same way as the XML output method would represent them when the version parameter is set to 1.0."

According to section 5.1.7,[2] undeclaration of prefixes only occurs if the undeclare-namespaces parameter has the value "yes" and the version parameter has a value greater than 1.0, neither of which condition is true for an XML island in HTML.

Of course, the text that I've quoted from 7.1 applies to namespace nodes in the result tree, and your question is regarding elements that have namespace nodes for particular prefixes, but whose child elements do not have namespace nodes for those prefixes.  However, I believe the text from 7.1 still applies here - namespace declarations and namespace undeclarations are both triggered by the presence of namespace nodes in the result tree, but undeclaration of prefixes will not occur because the namespace attributes are handled as if the version parameter was set to 1.0.

This is my personal response, not that of the XSL and XQuery Working Groups.

[1] http://www.w3.org/TR/xslt-xquery-serialization/#HTML_MARKUP
[2] http://www.w3.org/TR/xslt-xquery-serialization/#xml-undeclare-NS
Comment 2 Henry Zongaro 2010-06-08 14:59:47 UTC
At its teleconference of 3 June 2010,[3] the XSL Working Group directed me "to slightly modify comment 1 (clarification re XML islands) and ask for ratification by XQuery."  That was because of a remark I made during the call stating that item 1 in section 7.1 of the Serialization Recommendation[2] pertained to namespace nodes on elements that are in no namspace and that item 2 pertained to so-called XML islands, and that such islands are serialized according to the rules of the XML output method with version parameter set to 1.0 -- which would again imply that undeclaration of namespace prefixes must not occur.

However, I realized afterward that my on-the-fly reading was incorrect:  item 2 in 7.1 pertains only to how the QName of an element or attribute that is in a namespace must be serialized, not to how the entire XML island must be serialized.  Per the first paragraph of 7.1, XML islands "MUST be output in the same way as a non-empty, inline element such as span."

So, the first item in the numbered list of 7.1 applies to namespace nodes on any element, regardless of whether that element is in a namespace.  So I believe my analysis of comment 1 still stands - that no undeclaration of the prefix "dummy" on element "my:island" will appear in the serialized document, nor will any undeclaration of the prefix "foo" on the HTML element "strong" appear.

[3] http://lists.w3.org/Archives/Member/w3c-xsl-wg/2010Jun/0011.html (Member-only link)
Comment 3 Henry Zongaro 2010-06-24 18:51:14 UTC
At its telecon of 24 June, 2010,[4] the XSL WG agreed with the analysis of comment 1 and comment 2 that no undeclarations of namespace prefixes will appear in the serialize result, and that no changes to the Serialization recommendation are necessary.

I will bring this before the XQuery WG for ratification.

[4] http://lists.w3.org/Archives/Member/w3c-xsl-wg/2010Jun/0166.html (Member-only link)
Comment 4 Henry Zongaro 2010-07-06 18:45:17 UTC
At the joint teleconference of the XQuery and XSL Working Groups of 6 July 2010,[5] the XQuery Working Group concurred with the decision of the XSL WG reported in comment #3.

Tim, if you agree with this decision, may I ask you close the bug report?  Otherwise, please reopen it.

[5] http://lists.w3.org/Archives/Member/w3c-xsl-query/2010Jul/0086.html (Member-only link)
Comment 5 Tim Mills 2010-07-08 12:46:58 UTC
Thanks.