[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-security-dev
Subject:    Re: XPath or XPointer
From:       "Peter Tornberg" <tberg () x-obi ! com>
Date:       2001-10-09 14:12:32
[Download RAW message or body]

Hi Christian,

Now it works like a charm. Thanks for your patience and explenations, I
think I get it now (at last).

/Peter

----- Original Message -----
From: "Christian Geuer-Pollmann" <geuer-pollmann@nue.et-inf.uni-siegen.de>
To: "Peter Tornberg" <tberg@x-obi.com>
Cc: <security-dev@xml.apache.org>
Sent: Tuesday, October 09, 2001 3:48 PM
Subject: Re: XPath or XPointer


> Hi Peter
>
> > <prof:XPath>
> >    here()
> > </prof:XPath>
>
> The spec [1] says:
>
>    The XPath expression appearing in the XPath
>    parameter is evaluated once for each node in the
>    input node-set. The result is converted to a
>    boolean. If the boolean is true, then the node
>    is included in the output node-set. If the
>    boolean is false, then the node is omitted
>    from the output node-set.
>
> [1] http://www.w3.org/TR/xmldsig-core/#sec-XPath
>
>
>
> If you simply say:
>
> <ds:XPath>
> here()
> </ds:XPath>
>
> this xpath returns a node-set containing the ds:XPath Element. The
> evaluation of the XPath according to the spec converts this node-set into
a
> boolean and the XPath spec says that non-empty node-sets are true when
> converted to boolean. So every node in the document in included, because
> "here()" always evaluates to true.
>
> What you want to say is that only nodes in a particular Object should be
> included, so you must create an XPath that only evaluates to 'true' for
> descendants of the Object:
>
> The first ds:Object in your ds:Signature is identified by
>
> <ds:XPath>
> here()/ancestor::ds:Signature[1]/ds:Object[1]
> </ds:XPath>
>
> This XPath returns the correct Object, but evaluated to true, too. Now you
> have to add something that is only true for children etc. of this
ds:Object
>
> <ds:XPath>
> ancestor-or-self::node() = here()/ancestor::ds:Signature[1]/ds:Object[1]
> </ds:XPath>
>
> Which is true if the selected ds:Object is an ancestor of the current node
> or if it is it itself (horrible english, sorry)..
>
> Christian

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic