XPath question

Hi all,

Having read the XPath Rec, I found the following paragraph in
section 2.3 about node tests:

  "A QName in the node test is expanded into an expanded-name using the
namespace
  declarations from the expression context. This is the same way expansion
is done
  for element type names in start and end-tags except that the default
namespace
  declared with xmlns is not used: if the QName does not have a prefix, then
the
  namespace URI is null (this is the same way attribute names are expanded).
It
  is an error if the QName has a prefix for which there is no namespace
  declaration in the expression context."

Does this really mean, that I cannot select a node which has a default
namespace
declared? Consider the following example:

<NS1:DocElement xmlns="http://anywhere.com/default"
xmlns:NS1="http://anywhere.com/ns1">
  <NS1:FirstChild/>
  <SecondChild/>
</NS1:DocElement>

What should the XPath expression "/descendant::SecondChild" provide as
result?

  a) An empty node set, since the expression should select a node with
     an expanded-name constisting of an empty namespace URI and a local part
     equal to "SecondChild"?

  b) A node set consisting of a single element node, since the expression
     should select a node with an expanded-name constisting of the default
     namespace URI ("http://anywhere.com/default") and a local part equal
     to "SecondChild"?

If a) is the answer, we should add a few sentences in the spec, that we
recommend
to introduce a namespace prefix for the XML-Signature elements, and not to
use
the default namespace for them. Otherwhise it would not be possible to
select
such elements with XPath expressions.

Regards, Gregor
---------------------------------------------------------------
Gregor Karlinger
mailto://gregor.karlinger@iaik.at
http://www.iaik.at
Phone +43 316 873 5541
Institute for Applied Information Processing and Communications
Austria
---------------------------------------------------------------

Received on Thursday, 7 September 2000 07:38:28 UTC