[ 
https://issues.apache.org/jira/browse/SLING-491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12601111#action_12601111
 ] 

Felix Meschberger commented on SLING-491:
-----------------------------------------

A simple workaround would of course be :

    <sling:include resourceType=<%= resource.getResourceType + "/content" %> />

As resource types are basically strings only later used as path components I 
would also not use this mechanism. If it would be a broader request to have 
synthactic sugar for this case, I would imagine one of these approaches:

    <sling:include resourceType="+/content" %> />

or

    <sling:include resourceTypeAppend="/content" />

The first case has the "+" sign to indicate to append the resource type value 
to the resource type of the request resource. The second one explicitly sets a 
suffix for the request resource type similar to the "addSelectors" attribute.

More elaborate stuff can still be done by some minimal coding, such as ../ 
support:

    <%
    String type = resource.getResourceType() + "../../sample";
    type = ResourceUtil.normalize(type);
    %>
    <sling:include resourceType="<%= type %>" />

> Allow relative resource type overrides in include tag
> -----------------------------------------------------
>
>                 Key: SLING-491
>                 URL: https://issues.apache.org/jira/browse/SLING-491
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting JSP
>    Affects Versions: 2.0.0
>            Reporter: Tobias Bocanegra
>            Priority: Minor
>         Attachments: rel_resourceType.patch
>
>
> it would be cool, if you can specify a relative resource type in a sling 
> include, eg:
> <sling:include resourceType="./content" />
> assuming resource.getResourceType() == "/foo/bar" the override would be 
> "/foo/bar/content" .

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to