W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2004

[XQuery] 3.7.4 Namespace nodes on constructed elements

From: Jonathan Robie <jonathan.robie@datadirect.com>
Date: Thu, 12 Feb 2004 20:01:47 -0500
Message-ID: <402C21FB.5080105@datadirect.com>
To: XML Query Comments <public-qt-comments@w3.org>

For many applications, namespace node preservation is overweight. For
others, it is needed. The current definition of XQuery can easily
result in large numbers of superfluous namespace nodes, especially
when querying documents that use several namespaces.

Consider the following data, taken from the DOM Issues List:

<issues xmlns:xlink="http://www.w3.org/1999/xlink"

    <title>DOM Level 3 Core Issues List</title>
    <!-- SNIP -->

Now consider the following query, applied to this data:


Here is the result, according to our current spec:

 <title xmlns:xlink="http://www.w3.org/1999/xlink"
  >DOM Level 3 Core Issues List</title>

Although none of these namespaces are actually used in the title
element that was retrieved, our current specification require that all
namespaces in scope in the original document must be in scope for the
copied element in the constructed element. Now suppose that we create
several namespace-decorated documents like this one, and perform an
XQuery that copies from each of these to create a new document with
even more namespaces...

Naturally, we do need to ensure that namespaces are preserved if they
are used in element names, attribute names, or QNames. Consider the
following query:


The result must preserve the above-mentioned namespaces to allow
correct interpretation:

<originator xlink:type='simple'
xlink:href="mailto:caillon@netscape.com">Christopher Aillon</originator>

There are also XML vocabularies, such as XML Schema or XSLT, that use
QNames in content, and for these, all QNames really must be

I think we should provide two modes of operation:

1. Namespace preserving copy keeps all namespace nodes

2. Normal copy keeps only namespace nodes used in element names,
   attribute names, or instances of xs:QName.

One possibility would be to declare this at a global level:

  declare namespace-preserving = "true";

Another possibility would be to declare namespace preservation for
specific namespaces:

  declare namespace-preserving = "http://www.w3.org/2001/XMLSchema",

Either of these would reduce the overhead associated with copying
elements significantly in some implementation environments.

Received on Thursday, 12 February 2004 20:04:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:17 UTC