Hi Roy

I see, thanks for the pointer. I didn't know that was allowed in XPath.

Glad you got a solution. I'm almost certain that the following would
also work: 
/jcr:root/content/site//element(*,cq:PageContent)/parsys/some-component
for your case.

Regards
Julian


On Tue, Oct 11, 2016 at 1:44 PM, Roy Teeuwen <r...@teeuwen.be> wrote:
> Hey Julian,
>
> This is standard XPath and worked in JCR 2, for example if you look at these 
> samples provided by microsoft:
> https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx 
> <https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx>
> book[excerpt] : All <book> elements that contain at least one <excerpt> 
> element child.
>
> A real life used example:  
> /jcr:root/content/site//element(*,cq:PageContent)[parsys/some-component] to 
> select pages with a specific component in the parsys
> But they gave me a workable solution in the oak-dev channel, although it 
> should still work in the old way according to xpath :)
>
> The solution they provided:  something like 
> /jcr:root/content/site//element(*,cq:PageContent)[parsys/some-component/@jcr:primaryType]
>
> Greetings,
> Roy
>
>> On 11 Oct 2016, at 11:54, Julian Sedding <jsedd...@gmail.com> wrote:
>>
>> Not sure why this worked in JR2 (and whether that was a  bug or a feature).
>>
>> IMO you need to test for /jcr:root//*[fn:name() = 'test'] (or if there
>> are no other conditions simply /jcr:root//test).
>>
>> Regards
>> Julian
>>
>>
>> On Mon, Oct 10, 2016 at 1:14 PM, Roy Teeuwen <r...@teeuwen.be> wrote:
>>> Hey all,
>>>
>>> I’m not really getting a reply in the oak-dev channel, so I might as well 
>>> also try here because I’m trying it in a sling application :)
>>>
>>> When doing the following XPath query in JCR 2, it would select me all the 
>>> nodes that has a subnode named test. But since upgrading to oak, this query 
>>> does not work anymore. Is there a reason this stopped working or a way to 
>>> make it work again
>>>
>>> Some query example:
>>> /jcr:root//*[test] or 
>>> /jcr:root/content/site//element(*,nt:unstructured)[@jcr:createdBy='admin' 
>>> and test]
>>>
>>> Greetings,
>>> Roy
>

Reply via email to