jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: XPATH question
Date Wed, 06 Jun 2007 12:05:03 GMT
Andre Scheunemann wrote:
> Thanks for the reply.  Here are a couple more questions:
> 
> I would like to limit the selection to nodes matching a pattern such as 
> *.abc
> I've tried the following without success:
>    //*[jcr:like(name(), '%abc)]
>    //*[@jcr:path, '%abc')]

this is not possible, the only operator that is supported on the node name is 
equals and you also need to prefix the name() function with fn:

//*[fn:name() = 'abc']

> Is there a way to combine multiple nodetype tests in a single search for 
> example:
>    element(*, nt:file)  and element(*, someMixinType)
>    element(*, nt:file)  or  element(*, nt:folder)

you can use the property jcr:primaryType and jcr:mixinTypes, but you have to 
take care of the node type inheritance yourself.

//element(*, nt:file)

returns all nt:file nodes as well as all nodes with a sub type of nt:file.

//*[@jcr:primaryType = 'nt:file']

will only return node with exactly the primary type nt:file. but you can now add 
more clauses:

//*[@jcr:primaryType = 'nt:file' and jcr:mixinTypes = 'someMixinType']

or another example:

//*[@jcr:primaryType = 'nt:file' or jcr:primaryType = 'nt:folder']

regards
  marcel

Mime
View raw message