You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by janandith jayawardena <ja...@gmail.com> on 2008/07/15 18:55:21 UTC

How can I use selectors and suffix with

Hi,

How can I use selectors and suffix  with <sling:include> tag.

It's bit confusing ,

Ex: The sling.api page has a table with examples like
"/a/b.s1.s2.html/c/d" saying s1.s2 is a selector and c/d is a suffix.
does means s1 = a/b and s2=c/d such that in a script /a/b can be replaced
with s1 and /c/d replaced with s2.

janandith.

Re: How can I use selectors and suffix with

Posted by Tobias Bocanegra <to...@day.com>.
On 7/15/08, janandith jayawardena <ja...@gmail.com> wrote:
> Hi,
>
>  How can I use selectors and suffix  with <sling:include> tag.
you can either replace the selectors by:

<sling:include ... replaceSelectors="foo.bar" />

or add an additional ones by:

<sling:include ... addSelectors="foo.bar" />

and set the suffix by:

<sling:include ... replaceSuffix="myfile.jpg" />

see [1] for documentation

>  It's bit confusing ,
>
>  Ex: The sling.api page has a table with examples like
>  "/a/b.s1.s2.html/c/d" saying s1.s2 is a selector and c/d is a suffix.
>  does means s1 = a/b and s2=c/d such that in a script /a/b can be replaced
>  with s1 and /c/d replaced with s2.

no. '/a/b' is not the script, but the resource path. the 'selectors'
are 's1.s2' and the suffix is '/c/d'. the addressed resource is always
/a/b and the extension is '.html'. if you wish to use another "script"
for the same resource, use the 'resourceType' attribute. eg:

<sling:include resourceType="foo/bar" />

regards, toby

[1] http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/request/RequestDispatcherOptions.java?view=markup