jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: XPath help
Date Mon, 05 Oct 2009 12:43:18 GMT
On Mon, Oct 5, 2009 at 14:34, Ben Short <ben@benshort.co.uk> wrote:
> I have 2 nodes:
>
> /catalog/products/wooly_hat
> /catalog/products/top_hat
>
> both nodes have a title property.
>
> I can't figure out how to write a XPATH query that will return nodes that
> have a supplied value as there title. An SQL equivalent would be something
> like select * from products where title = 'Wooly Hat'.
>
> I have a query as follows but I'm not sure where to go with it. It feels
> like I need to have a wild card to indicate that I want to search in each of
> the products child nodes.
>
> //catalog/products[@name = 'Wooly Hat']
>
> Can anyone give me a pointer?

/jcr:root/catalog/products/*[@name = 'Wooly Hat']

or

/jcr:root/catalog/products//*[@name = 'Wooly Hat']

if you want to search not only the direct children of products, but
also any descendants.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message