Deleting namespace nodes

All,

A few data points:

1. XPath 2 has namespace nodes in its data model, but does not require
exposing them to XPath

"XPath 2.0 implementations are not required to expose the namespace axis,
though they may do so if they wish to offer backwards compatibility." [1]

If the implementation doesn't  support the namespace axis, you have
functions to obtain namespace *information*, such as `fn:in-scope-prefixes`
[2], but you cannot select nodes with those. If the namespace axis is
supported, the delete action can reference namespaces.

Saxon, in particular, supports the namespace axis.

2. It doesn't look like XQuery Update supports adding/removing namespace
nodes.

3. Our implementation supports removing namespace nodes with the `delete`
 action. For example,  I have this delete action in our code:

    <xf:delete ref="instance()/namespace::fr"/>

It also supports inserting namespace nodes by copy, for example:

    <xf:insert context="instance()"
origin="instance()/fr:snapshot/namespace::fr"/>

4. XSLT has a way of creating new namespace nodes. [3]

It seems to me  that there are weaknesses in namespace handling in XPath 2
and XQuery, including XQuery Update. XSLT on the other hand has more
comprehensive handling of namespaces.

I think that it makes sense to be able to manipulate namespaces at that
level.

As far as the XForms spec is concerned, maybe we could say that if the
XPath implementation supports accessing the namespace axis, the delete
action should support removing them when possible. The insert action can be
updated along these lines too.

Another way would be to have separate actions to insert and removing
namespaces, but I don't think we want to do this right now.

-Erik

[1] http://www.w3.org/TR/xpath-datamodel/#NamespaceNode
[2] http://www.w3.org/TR/xpath-functions/#func-in-scope-prefixes
[3] http://www.w3.org/TR/xslt20/#creating-namespace-nodes

Received on Wednesday, 30 September 2015 16:14:55 UTC