Subject: Re: XPath and namespace nodes: a tough one
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Fri, 19 Dec 2008 16:07:18 +0100 (CET)
|
Andrew Welch wrote:
> let $foo := <n0:pdu xmlns:n0="http://a.example">
> <n1:elem1 xmlns:n1="http://b.example">
> content
> </n1:elem1>
> </n0:pdu>
> return $foo/*
> you get:
> <n1:elem1 xmlns:n1="http://b.example">
> content
> </n1:elem1>
Which is not really nice if you have something like:
<n1:elem1 xmlns:n1="http://b.example" value="n0:something">
content
</n1:elem1>
BTW, Elliotte said:
> The subdocument with elem1 as its apex node can be extracted from
> this second case with an XPath expression such as:
> (//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1]
But this expression returns a node set with several nodes, all
descendant of n1:elem1, and not the element n1:elem1 (with its
descendant.)
Unfortunately, this is not possible to discard a namespace in
XPath only.
Regards,
--
Florent Georges
http://www.fgeorges.org/
|