Re: Namespace in the XPath tag

Let's give another example: If you use a, b and c in your XPath, you should 
define them in the ds:XPath element like here:

<XPath xmlns:a="..." xmlns:b="..." xmlns:c="...">
   a:foo and not b:baz and c:bar
</Xpath>

(The xpath itself is nonsense, only to show that the prefixes are used). 
But you can also do this in an ancestor of the ds:XPath element:

<document xmlns:a="..." xmlns:b="..." xmlns:c="...">
  ...
  <XPath>
    a:foo and not b:baz and c:bar
  </Xpath>
  ...
</document>

This ensures that the namespaces are "in scope" in the XPath element.


/Christian



--On Montag, 8. Juli 2002 14:22 +0800 Herry <herrykoh@yahoo.com> wrote:

> Hi Christian,
> thanks for the reply.
>
> When you said 'used namespaces', does it refer to the
> namespaces used within the XPath expr? So for any
> namespaces used in the XPath expr, they will have to
> be declared somewhere that is visible to the XPath
> expr. It doesn't matter that the namespace declaration
> in the XPath expr is declared in the XPath tag, we can
> similarly declare that in the, say, <Transforms> tag
> if we want, is that correct.
>
> Just want to clarify as I am still a novice in XPath
> :)
>
> Thanks.
>
> Cheers,
> Herry
>
>
>  --- Christian Geuer-Pollmann
> <geuer-pollmann@nue.et-inf.uni-siegen.de> wrote: > Hi
> Herry,
>>
>> In this snippet:
>>
>> >  <XPath xmlns:dsig="&dsig;">
>> >    not(ancestor-or-self::dsig:Signature)
>> >  </XPath>
>>
>> the namespace is only declared because the Xpath
>> expression in the text
>> node uses the dsig prefix. The XPath element is a
>> good place to (re)define
>> namespaces which are used by the xpath expression.
>> So it is NOT mandatory
>> to bind the XML Signature namespace in a special
>> way. You only have to take
>> care that the used namespaces are defined. (You can
>> also do this in the
>> Transforms or the Signature element or even in your
>> document element...
>>
>>
>> Christian
>>
>> --On Montag, 8. Juli 2002 10:56 +0800 Herry
>> <herrykoh@yahoo.com> wrote:
>>
>> >
>> > Hi,
>> > in the current XML DSIG specification [1], under
>> > section 6.6.3, there is an example of how an XPath
>> tag
>> > will look like inside a <Signature> tag. I've
>> noticed
>> > an additional namespace declaration in the XPath
>> tag:
>> > <XPath xmlns:dsig="&dsig;">.
>> >
>> > Just want to clarify whether this is mandatory if
>> my
>> > XPath expression does not involve any Signature
>> tags
>> > or tags belonging to the Signature namespace.
>> >
>> > Cheers,
>> > Herry
>> >
>> > [start example below from [1]]
>> >
>> >  <Document>
>> >    ...
>> >    <Signature
>> > xmlns="http://www.w3.org/2000/09/xmldsig#">
>> >      <SignedInfo>
>> >       ...
>> >        <Reference URI="">
>> >          <Transforms>
>> >            <Transform
>> >
>>
> Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
>> >              <XPath xmlns:dsig="&dsig;">
>> >              not(ancestor-or-self::dsig:Signature)
>> >              </XPath>
>> >            </Transform>
>> >          </Transforms>
>> >          <DigestMethod
>> >
>> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
>> >          <DigestValue></DigestValue>
>> >        </Reference>
>> >      </SignedInfo>
>> >      <SignatureValue></SignatureValue>
>> >     </Signature>
>> >     ...
>> >    </Document>
>> >
>> > [1] http://www.w3.org/TR/xmldsig-core/
>> >
>> > __________________________________________________
>> > Do You Yahoo!?
>> > Yahoo! Tech - Get in touch with the latest in
>> technology.
>> > http://sg.tech.yahoo.com
>> >
>>
>>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tech - Get in touch with the latest in technology.
> http://sg.tech.yahoo.com

Received on Monday, 8 July 2002 02:28:18 UTC