You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Gul Akbar <G....@Bradford.ac.uk> on 2003/04/05 12:35:26 UTC

xpath for NOT Operator

Hi,
Can you perform a query with the boolean NOT operator? can anyuone give me 
examples.
I have the query:
 //mets [ /mets/agent/name='Gul Akbar' NOT /mets/role='Administrator' ]

Also is there any XPath that allows you to carry out phrase searching, or word 
searches?

Thanks in advance
Gul Akbar

-------------------------------------------------
This mail sent through IMP: webmail.brad.ac.uk

Re: xpath for NOT Operator

Posted by Richard Light <ri...@light.demon.co.uk>.
In message <00...@THEBEAST>, Paul Brown
<pj...@cs.nott.ac.uk> writes
>>>Also is there any XPath that allows you to carry out phrase searching,
>
>>>or word searches?
>
>>You have the contains() and starts-with() functions.
>
>Is there a way to make contains() case insensitive?

It's not pretty, and I'm sure it wouldn't be efficient in a searching
context, but there is the translate() function:

        ... contains(translate(text(), 'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'SEARCHSTRING') ...

Richard Light
-- 
Richard Light
SGML/XML and Museum Information Consultancy
richard@light.demon.co.uk


RE: xpath for NOT Operator

Posted by Paul Brown <pj...@cs.nott.ac.uk>.
>>Also is there any XPath that allows you to carry out phrase searching,

>>or word searches?

>You have the contains() and starts-with() functions.

Is there a way to make contains() case insensitive?

Paul

-----Original Message-----
From: Richard Light [mailto:richard@light.demon.co.uk] 
Sent: 05 April 2003 13:03
To: xindice-users@xml.apache.org
Subject: Re: xpath for NOT Operator


In message <10...@webmail.brad.ac.uk>, Gul Akbar 
<G....@Bradford.ac.uk> writes
>
>Hi,
>Can you perform a query with the boolean NOT operator? can anyuone give

>me examples. I have the query:
> //mets [ /mets/agent/name='Gul Akbar' NOT /mets/role='Administrator' ]

Check out the XPath standard: it isn't a secret! :-

http://www.w3.org/TR/xpath

I think your example query would have more luck if re-phrased thus:

//mets[agent/name='Gul Akbar' and not(role='Administrator')]

>Also is there any XPath that allows you to carry out phrase searching, 
>or word searches?

You have the contains() and starts-with() functions.

Richard Light
-- 
Richard Light
SGML/XML and Museum Information Consultancy richard@light.demon.co.uk



Re: xpath for NOT Operator

Posted by Richard Light <ri...@light.demon.co.uk>.
In message <10...@webmail.brad.ac.uk>, Gul Akbar 
<G....@Bradford.ac.uk> writes
>
>Hi,
>Can you perform a query with the boolean NOT operator? can anyuone give me
>examples.
>I have the query:
> //mets [ /mets/agent/name='Gul Akbar' NOT /mets/role='Administrator' ]

Check out the XPath standard: it isn't a secret! :-

http://www.w3.org/TR/xpath

I think your example query would have more luck if re-phrased thus:

//mets[agent/name='Gul Akbar' and not(role='Administrator')]

>Also is there any XPath that allows you to carry out phrase searching, or word
>searches?

You have the contains() and starts-with() functions.

Richard Light
-- 
Richard Light
SGML/XML and Museum Information Consultancy
richard@light.demon.co.uk