xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] XPath and namespace nodes: a tough one


Subject: [xsl] XPath and namespace nodes: a tough one
From: Elliotte Harold <elharo@xxxxxxxxxxxxxxx>
Date: Fri, 19 Dec 2008 06:31:08 -0800

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@xxxxxxxxxxxxxxx
Refactoring HTML Just Published!
http://www.amazon.com/exec/obidos/ISBN=0321503635/ref=nosim/cafeaulaitA


Current Thread
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor