[xmlsec] inconsistent XPath: xmlsec vs apache.org's xml-security

Daniel Veillard veillard at redhat.com
Tue Jan 4 09:57:56 PST 2005


On Tue, Jan 04, 2005 at 09:35:50AM -0800, Aleksey Sanin wrote:
> - Third Signature element has Reference with the following XPath2
> transform:
>   intersect: here()/ancestor::frog:compliance[1]
>   subtract: here()/ancestor::frog:compliance[1]/child::ds:Signature
> 
> This selects the <compliance> element from the document and
> then removes the *third Signature* element only (see attached third.xml
> file, formatting is added to make it readable) and I think you expect
> it to remove *all Signature* elements from the document.
>
> I believe, that this behaiviour is related to "here()" function. And we 
> need Daniel to say if this is correct or not. Daniel, what should the
> following XPath query return
>    here()/ancestor::frog:compliance[1]/child::ds:Signature
> 
> 1) Only the current (from here() context) Signature element
> 2) All the Signature elements under <frog:compliance> element

  I'm don't think I grasp the example fully, but I would expect
here() to return a nodeset with a single element, so 
    here()/ancestor::frog:compliance[1]
should also contain a single element (as it is selecting the first
node in the node set of the frog:compliance ancestors).
And then here()/ancestor::frog:compliance[1]/child::ds:Signature should
select all the ds:Signature children from that frog:compliance node, 
and I think there is only one such child in this case.
  here() in xmlsec is if I remember correctly related to the here()
we defined in XPointer which means the node carrying the XPointer expression,
and in that case that would be the node carrying the 
    here()/ancestor::frog:compliance[1]
  or
    here()/ancestor::frog:compliance[1]/child::ds:Signature
XPath string.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



More information about the xmlsec mailing list