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 2260 - [xqueryx] namespace attributes
Summary: [xqueryx] namespace attributes
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQueryX 1.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Jim Melton
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-16 12:55 UTC by David Carlisle
Modified: 2005-09-27 09:39 UTC (History)
0 users

See Also:


Attachments

Description David Carlisle 2005-09-16 12:55:50 UTC
Currently a namespace declaration on a direct element constructor such as
<a xmlns:x="a"></a>
is encoded using

               <xqx:attributeConstructor>
                  <xqx:attributeName xqx:prefix="xmlns">x</xqx:attributeName>
                  <xqx:attributeValue>a</xqx:attributeValue>
               </xqx:attributeConstructor>

There is a certain amount of history as to why namespace declarations use
xml attribute syntax, but that history doesn't apply here. These are not
attributes to the XPath/Xquery data model, and they have a radically different
effect on the static context.  xmlns: isn't a prefix in the currently known
namespaces, so it's a misuse of the xqx:QName type to represent xmlns:x as
a Qname with prefix xmlns.

XqueryX should have a separate xqx:namespaceName
xqx:namespaceValue construct to generate the namespace binding.

the schema declaration for xqx:attributeName should have a pattern facet
restricting the name not to be xmlns or begin with xmlns:

David
Comment 1 David Carlisle 2005-09-19 09:47:58 UTC
 Actually I note that the example in section 3.4 encodes the namespace
declaration as
  <xqx:attributeName>xmlns:ma</xqx:attributeName>
rather than
    <xqx:attributeName xqx;prefix="xmlns">ma</xqx:attributeName>
but that's even worse: it's not valid against the schema which which has base type
xs:NCName so can't have a colon.
Comment 2 Jim Melton 2005-09-20 11:52:06 UTC
Thank you very much for this observation and discussion.  I have not yet spent
the time to think about this fully, but I'm inclined to agree with your point. 
We will investigate this more fully and come up with an appropriate way to
reprseent namespace declarations. 
Comment 3 Jim Melton 2005-09-26 21:56:02 UTC
We agree with your comment and have modified the XQueryX schema to permit
namespace declarations in element constructors through the use of a new element
xqx:namespaceDeclaration having subelements xqx:prefix and xqx:uri.  This new
element will be an alternative within xqx:attributeList.  We will also prohibit
xqx:attributeConstructor's xqx:attributeName child from taking on the value
"xmlns" or values starting with "xmlns:". 

We have enhanced the XQueryX stylesheet to reflect these changes. 

Please let us know if you agree with this resolution of your issue, by adding a
comment to the issue record and changing the Status of the issue to Closed. Or,
if you do not agree with this resolution, please add a comment explaining why.
If you wish to appeal the WG's decision to the Director, then also change the
Status of the record to Reopened. If you wish to record your dissent, but do not
wish to appeal the decision to the Director, then change the Status of the
record to Closed. If we do not hear from you in the next two weeks, we will
assume you agree with the WG decision.
Comment 4 David Carlisle 2005-09-26 22:56:20 UTC
   We will also prohibit
   xqx:attributeConstructor's xqx:attributeName child from taking on the value
   "xmlns" or values starting with "xmlns:".


This is what I suggested but actually you only need to restrict xmlns.
xmlns: isn't allowed anyway as the base type of attributeNmae is xs:NCName so
doesn't allow :.

However I leave the details to the editor and am closing this report anyway.

Comment 5 David Carlisle 2005-09-27 09:39:28 UTC
One further comment, even though this is closed

It may be best to make the restriction in the stylesheet generating an error
if the attribute name is xmlns _and no prefix_.

XSD schema can't restrict the content based on the non appearance of an
attribute. You probably do need to allow an attribute named fobar:xmlns
(ie xqx:prefix="foobar" and content equal to xmlns, as these are allowed even
though bad form, xmlns 1.1 says:


http://www.w3.org/TR/xml-names11/#xmlReserved
Though they are not themselves reserved, it is inadvisable to use prefixed names 
whose LocalPart begins with the letters x, m, l, in any case combination, as
these names would be reserved if used without a prefix.