RE: Re: Re: XPath Expression


XPath Expression: (//. | //@* | //namespace::*)[not (self::attribute and
(name()=URI) and parent::Reference)]

My transformed node-set was the same as the input node set. My input file
was decidedly simple:

<?xml version="1.0" encoding="UTF-8"?>
<Reference URI="foo"> Hello People! </Reference>

I was expecting to get:

<Reference> Hello People! </Reference>

But instead got:

<Reference URI="foo"> Hello People! </Reference>

I think that you assume that self::attribute selects acts as a node test,
i.e. that is selects the node if it is of type Attribute. But node tests
are available in XPATH only for comment, text, pi, and node, not for
attribute. What self::attribute actually does is to select the node if
its name equals "attribute". In your example, there is no such node, and
therefore the predicate [not(...)] is always true. This leads to the
result you mentioned.

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


Received on Monday, 6 August 2001 03:22:25 UTC