xsl-list
[Top] [All Lists]

[xsl] XPath and namespace nodes: a tough one

2008-12-19 09:31:35
From the Exclusive XML canonicalizati0on spec we have the following:

As a simple example of the type of problem that changes in XML context can cause for signatures, consider the following document:

   <n1:elem1 xmlns:n1="http://b.example";>
       content
   </n1:elem1>

this is then enveloped in another document:

   <n0:pdu xmlns:n0="http://a.example";>
      <n1:elem1 xmlns:n1="http://b.example";>
          content
      </n1:elem1>
   </n0:pdu>

The first document above is in canonical form. But assume that document is enveloped as in the second case. 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]

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?

--
Elliotte Rusty Harold  elharo(_at_)metalab(_dot_)unc(_dot_)edu
Refactoring HTML Just Published!
http://www.amazon.com/exec/obidos/ISBN=0321503635/ref=nosim/cafeaulaitA

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>