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 9298 - [XPath21] namespace-node() as a KindTest in an Axis Step
Summary: [XPath21] namespace-node() as a KindTest in an Axis Step
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 3.0 (show other bugs)
Version: Working drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-22 18:40 UTC by Michael Kay
Modified: 2013-06-19 08:15 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2010-03-22 18:40:39 UTC
XPath 2.1 has introduced the syntax namespace-node() as a new kind of KindTest. As such it can be used in an AxisStep, for example we can write A/B/namespace-node().

Section 3.2.4 says: "If the axis name is omitted from an axis step, the default axis is child unless the axis step contains an AttributeTest or SchemaAttributeTest; in that case, the default axis is attribute. "

Logically, this rule should be extended so that when the axis step contains the KindTest namespace-node(), the default axis is namespace.

The only difficulty here of course is that the namespace axis is deprecated, which means that the KindTest namespace-node() when used as an AxisStep should be deprecated, but it seems odd to introduce new syntax and deprecate it at the same time. Yet the alternative, of introducing an asymmetry between a KindTest used in an AxisStep and a KindTest used as an ItemType seems worse.

The current spec says that you can write A/B/namespace-node() and it will never select anything, which also seems highly unsatisfactory.
Comment 1 Michael Kay 2010-03-22 18:43:12 UTC
>The current spec says that you can write A/B/namespace-node() and it will never
select anything, which also seems highly unsatisfactory.

I should add (and this is how I got here) that it also makes it near-impossible to maintain the symmetry in XSLT between path expressions and match patterns.
Comment 2 Jonathan Robie 2010-05-04 17:13:14 UTC
In today's telcon, the XQuery WG reached the following decision:

Default axis for namespace() is the namespace axis.

In an implementation that does not support the namespace axis,
e.g. XQuery, it always raises an error.

In an XPath implementation, is is deprecated, but required in XSLT
implementations. If the implementation supports the namespace axis, it
returns the namespace node.