Project

Profile

Help

Bug #4661

closed

Namespace constructor: conflicting default namespaces

Added by Christian Grün over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XQuery conformance
Sprint/Milestone:
-
Start date:
2020-07-31
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, trunk
Fix Committed on Branch:
10, trunk
Fixed in Maintenance Release:
Platforms:

Description

The following expression…

declare default element namespace 'ns';
<x>{
  element a { namespace { '' } { 'ns2' } }
}</x>

…yields a result:

<x xmlns="ns"><_0:a xmlns="ns2" xmlns:_0="ns"/></x>

This expression…

<x xmlns='ns'>{
  element a { namespace { '' } { 'ns2' } }
}</x>

…raises an error (XTDE0430). Is that correct?

Actions #1

Updated by Michael Kay over 3 years ago

As far as I can see XQuery does not cover this situation and Saxon is following the XSLT rules, which do. It's not clear what other action is possible. You can't put the element in a different namespace, you can't give it a prefix bound to the null namespace, so you have to reject the namespace node as invalid.

There might be other outcomes that are consistent with the XQuery spec, but I think what Saxon is doing is reasonable.

Actions #2

Updated by Christian Grün over 3 years ago

Thanks for your assessment.

By intuition, I would have expected both expressions to yield the same result. But I didn’t find any clarification on this case in the spec either, and I doubt it will occur in practice anyway.

Actions #3

Updated by Christian Grün over 3 years ago

In addition, I noticed that element { ' a ' } {} returns < a />, while I would have expected an error. Considering your proposal in https://github.com/w3c/qtspecs/issues/9, a better alternative might be the normalization of whitespaces.

I can add a test case once we have decided for or against the error.

Actions #4

Updated by Michael Kay over 3 years ago

Whatever the phrase "If the atomized value of the name expression is of type xs:string or xs:untypedAtomic, that value is converted to an expanded QName." really means, I would expect any detailed rules to include first stripping whitespace, just as a cast operation does. Saxon is stripping whitespace to do the validation and is then erroneously using the original name as written. The bug (in XPathParser.makeNodeName()) is already fixed on the 10/11 branches, I will patch it now on 9.9 though I don't know if there will be another maintenance release on that branch,

Actions #5

Updated by Michael Kay over 3 years ago

  • Category set to XQuery conformance
  • Assignee set to Michael Kay
Actions #6

Updated by Michael Kay over 3 years ago

Discussed at team meeting. We felt that allowing URIQualifiedNames here was the right way to go, and if this meant defining new rules for the semantics of edge cases, we should go ahead and do this.

Actions #7

Updated by Michael Kay over 3 years ago

  • Status changed from New to Resolved
  • Priority changed from Low to Normal
  • Applies to branch 10, trunk added
  • Fix Committed on Branch 10, trunk added

I've reviewed the current state of this: new tests have been added, the product is passing the tests, and the new XQUery 4.0 draft clarifies the intended behaviour. Therefore closing.

Actions #8

Updated by O'Neil Delpratt about 3 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.5 added

Bug fix applied to Saxon 10.5 maintenance release.

Please register to edit this issue

Also available in: Atom PDF