User's Manual

22 Chapter 5. WAF Component: Presentation
com.arsdigita.templating.PatternStylesheetResolver class is the new preferred
resolver and now the default setting.
5.2.2.2. Pattern Based Resolution
The primary implementation of the stylesheet resolver interface is the class
com.arsdigita.templating.PatternStylesheetResolver. The core idea behind this
approach is that there is a list of abstract paths containing placeholders, of the form ::key::. For
example, a simplified version of the default list of paths looks like:
/__ccm__/apps/::application::/xsl/::url::-::locale::.xsl
/__ccm__/apps/::application::/xsl/::url::.xsl
When resolving which stylesheet to apply, the placeholders are expanded based on the request state,
to generate a list of real paths. Since a placeholder potentially has multiple valid values for a request, a
single abstract path could expand to multiple real paths. Placeholder expansion proceeds left-to-right,
to ensure a deterministic ordering of the list of real paths.
If we consider an example request for the content section admin pages at
/content/admin/index.jsp, the placeholder expansions might be:
::application:: -
(content-section)
::url:: - (admin, index)
::locale:: - (en_US, en)
If we proceed left-to-right with this expansion, the first expansion is for ::application::, leading
to:
/__ccm__/apps/content-section/xsl/::url::-::locale::.xsl
/__ccm__/apps/content-section/xsl/::url::.xsl
Next, the ::url:: placeholder is expanded:
/__ccm__/apps/content-section/xsl/admin-::locale::.xsl
/__ccm__/apps/content-section/xsl/admin.xsl
/__ccm__/apps/content-section/xsl/index-::locale::.xsl
/__ccm__/apps/content-section/xsl/index.xsl
Finally, the ::locale:: placeholder is expanded:
/__ccm__/apps/content-section/xsl/admin-en_US.xsl
/__ccm__/apps/content-section/xsl/admin-en.xsl
/__ccm__/apps/content-section/xsl/admin.xsl
/__ccm__/apps/content-section/xsl/index-en_US.xsl
/__ccm__/apps/content-section/xsl/index-en.xsl
/__ccm__/apps/content-section/xsl/index.xsl
Once all the placeholders have been expanded, these paths will be verified in order and the first
that exists returned as the primary stylesheet for the request. In this example the first match will
be /__ccm__/apps/content-section/xsl/admin.xsl.