Re: [xsl] XPath and namespace nodes: a tough one

Subject: Re: [xsl] XPath and namespace nodes: a tough one
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 19 Dec 2008 14:59:39 +0000
> The result of applying Canonical XML to the resulting XPath node-set is the
> following (except for line wrapping to fit this document):
>
>   <n1:elem1 xmlns:n0="http://a.example";
>             xmlns:n1="http://b.example";>
>       content
>   </n1:elem1>
>
> Note that the n0 namespace has been included by Canonical XML because it
> includes namespace context. This change which would break a signature over
> elem1 based on the first version.
>
> I'm trying to find an *XPath 1.0* (not XSLT) expression that will only
> include visibly utilized namespace nodes on an element. That is, applied to
> the above document I want to select
>
>  <n1:elem1 xmlns:n1="http://b.example";>
>       content
>   </n1:elem1>
>
> I'm beginning to think that isn't possible. Any ideas?


Interestingly enough, I'm suffering with the problem that is your
desired result, which I've raised on the eXist list this morning...

Fwiw, if you run this in eXist:

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>





-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread