RE: XPath question

Hi Gregor,

Actually, it doesn't mean that you can't match elements that are in the
default namespace.  For an example, see [1]

In the first code example, the Signature is in the default namespace of
&dsig;.  However, the XPath expression has the dsig prefix declared, and the
match to the Signature is done using dsig:Signature.  Thus, matching
elements in the default namespace can be done by setting up a prefix with
the same URI as the default namespace.

Incidentally, if [1] resolves to a draft that mentions the subexpression
(//. | //@* | //namespace::*), note that you no longer need this
subexpression as a result of the change of processing model.

John Boyer
Development Team Leader,
Distributed Processing and XML
PureEdge Solutions Inc.
Creating Binding E-Commerce
v: 250-479-8334, ext. 143  f: 250-479-3772
1-888-517-2675 <>

-----Original Message-----
[]On Behalf Of Gregor Karlinger
Sent: Thursday, September 07, 2000 4:39 AM
Subject: 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
  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
  declared with xmlns is not used: if the QName does not have a prefix, then
  namespace URI is null (this is the same way attribute names are expanded).
  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
declared? Consider the following example:

<NS1:DocElement xmlns=""

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

  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 ("") and a local part equal
     to "SecondChild"?

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

Regards, Gregor
Gregor Karlinger
Phone +43 316 873 5541
Institute for Applied Information Processing and Communications

Received on Thursday, 7 September 2000 13:26:08 UTC