XSLT stylesheet built-in functions
By declaring a namespace, you can access several built-in functions from the XSLT stylesheet in your Template Building Block, made available by Content Manager.
The following built-in functions are available in the namespace http://www.sdltridion.com/ContentManager/XsltTemplateHelper:
GetFormattedDate(string inputDate, string dateFormat): string-
Converts
inputDateto a string that corresponds todateFormatand returns the result as a string. GetListItems(string orgItemId): XmlDocument-
Returns an XML structure for the items residing in the organizational item (Folder, Structure Group and so on) identified by the Content Manager URI listed in
orgItemId. GetMultimediaInfo(string id): XmlDocument-
Returns an XML structure for the MIME type, file size and file extension for the binary file contained in the Multimedia Component identified by the Content Manager URI listed in
id.
The following simple example shows how to declare the namespace for these functions and how to use GetFormattedDate. The stylesheet writes out the date in the format specified.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tcm="http://www.tridion.com/ContentManager/5.0"
xmlns:mediator="http://www.sdltridion.com/ContentManager/XsltTemplateHelper"
xmlns:xlink="http://www.w3.org/1999/xlink" exclude-result-prefixes="tcm xlink">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<h2>Output:</h2>
<ol>
<xsl:value-of select="mediator:GetFormattedDate('2012-10-08T06:30:00', 'MMMM dd, yyyy')" />
</ol>
</xsl:template>
</xsl:stylesheet>