Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

First child selector for cq:include path

Anonymous
Not applicable

I have a cq:include and I want to reference the first child component of a parsys. Is it possible to query the first child in path attribute? For example, is something like this possible:

<cq:include path="/content/site/jcr:content/entries//*[1]" resourceType="site/components/entryType"/>

...where path is the xpath query for the first child component of the entries section.

1 Accepted Solution
Sham_HC
Correct answer by
Level 10
Level 10

Regular expression or xpath not supported.

Alternatively use iterator and get first one. Details at http://stackoverflow.com/questions/15413661/how-to-retrieve-first-par-node-from-content-page

View solution in original post

3 Replies
smacdonald2008
Level 10
Level 10
You can use selectors when using sling includes. See  http://insidecq5.com/wp/?p=60    
Sham_HC
Correct answer by
Level 10
Level 10

Regular expression or xpath not supported.

Alternatively use iterator and get first one. Details at http://stackoverflow.com/questions/15413661/how-to-retrieve-first-par-node-from-content-page

Anonymous
Not applicable

That's still not very clear on how to use selectors. From what I gathered from your site, I implemented the following. However, this does not seem to work. I am attempting to use the XPath first child selector, but I can seem to find any good documentation on what the selector should even be.

<sling:include path="/content/site/ads/jcr:content/adContent" addSelectors="//*[1]" resourceType="site/components/ad" />