1.
Notes
Important: it is not possible to use Sitecore XSL Extension Controls such as <sc:text> in an XSL Library. Use Sitecore XSL Extension Functions instead:
|
Sitecore XslControl
|
Substitution
|
|
<sc:date>
|
sc:formatdate(string IsoDate) sc:formatdate(string IsoDate, string Format)
|
|
<sc:dot>
|
dot:Render(.)
|
|
<sc:html>
|
sc:fld('html', .)
|
|
<sc:image>
|
sc:image('fieldName', .)
sc:image('fieldName', ., 'parameters')
|
|
<sc:link>
|
sc:GetLink(., 'parameters')
|
|
<sc:sec>
|
sc:HasRight('right', .)
//where right can be: 'a' - Admin, 'c' - Create, 'd' - Delete, 'n' - Rename, 'r' - Read, 'w' - Write
|
|
<sc:text>
|
sc:fld('fieldName, .)
|
|
<sc:enableSecurity>
|
sc:EnterSecurityState(bool)
|
|
<sc:disableSecurity>
|
sc:ExitSecurityState()
|
Sitecore XSL Extension Functions provide a superset of the functionality exposed by Sitecore XSL Extension Controls.
To reference the Library from other XSL renderings, add the following element under the existing <xsl:output> element:
<xsl:include href="functions.xslt" />
If an XSL Library will be referenced from most renderings, backup the existing file and add this reference to the XSL boilerplate /sitecore/client/templates/basic.xslt.
Methods in the Library can be invoked to write output:
<sc:link><xsl:call-template name="GetNavTitle" /></sc:link>
Or populate an XSL variable:
<xsl:variable name="parenttitle">
<xsl:call-template name="GetTitle">
<xsl:with-param name="item" select=".." />
</xsl:call-template>
</xsl:variable>
If the same lines of XSL code are ever needed in multiple contexts, they should almost always be factored out to an XSL Library.