Expand my Community achievements bar.

SOLVED

Advanced Selectors with Apache Sling

Avatar

Former Community Member

Does Apache Sling provide functionality for more complex selectors? I need to be able to select nodes with certain child properties as well as get the first child of a given node. I was hoping there would be some ability to query based on the XPath, but this doesn't seem possible using the REST framework.

1 Accepted Solution

Avatar

Correct answer by
Employee

Don't see how you can do this without custom code. 

How about registering a servlet to act on a specific selector and then you can place the logic you want in there? 

[0] https://helpx.adobe.com/experience-manager/using/resourcetypes.html

[1] https://balawcm.wordpress.com/2012/11/14/develop-a-custom-cq-selector/

View solution in original post

3 Replies

Avatar

Employee

A few questions if you don't mind:

What is it you are trying to achieve?

How do you you want to use this functionality?

Do you want to apply these selectors against all content or specific resource types?

Avatar

Former Community Member

I'm trying to select the first-of-type given a content path. I'm hoping I can use a selector like this *without* creating a whole new custom component. I am attempting to apply the selector against an image type, but if I can do it for any content, that would work as well.

Avatar

Correct answer by
Employee

Don't see how you can do this without custom code. 

How about registering a servlet to act on a specific selector and then you can place the logic you want in there? 

[0] https://helpx.adobe.com/experience-manager/using/resourcetypes.html

[1] https://balawcm.wordpress.com/2012/11/14/develop-a-custom-cq-selector/