Skip to main content
Oct 16, 2015 2:27 AM UTC
Solved

Advanced Selectors with Apache Sling

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
ogillAccepted solution
Adobe Employee
Oct 16, 2015 2:27 AM UTC

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/

3 replies

ogillAdobe EmployeeAccepted solution
Adobe Employee
Oct 16, 2015 2:27 AM UTC

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/

Translate
Oct 16, 2015 2:27 AM UTC

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.

Translate
Adobe Employee
Oct 16, 2015 2:27 AM UTC

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?

Translate