XSLTTool documentation for the dotCMS Content Management System

The XSLTTool provides a way to read from an XML source while providing XSLT transformation styling.

The following example shows how the TextTool is mapped in the toolbox-xml file:


Both methods in the XSLTTool take 3 parameters: URL to the XML, URL to the XSLT, and a cache ttl. The ttl is passed as the number minutes that the page will cache before refreshing the read of content from the xml source page.

Example 1

#set($xmlUrl = 'http://www.w3schools.com/XML/cd_catalog.xml')
#set($xsltUrl = '/demos/integration/demo-stylesheet.xsl')
$xslttool.transform($xmlUrl, $xsltUrl, 30)

Example 2

#set($xmlUrl = "http://www.w3schools.com/XML/cd_catalog.xml")
#set($xsltUrl = "/demos/integration/demo-stylesheet.xsl")
#set($XSLTransDoc =$xslttool.XSLTTransform($xmlUrl, $xsltUrl,30))

Here is an example of the xsl stylesheet code referenced in both of the examples above:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"

<xsl:template match="/">
    <h2>My CD Collection</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
      <xsl:for-each select="CATALOG/CD">
          <td><xsl:value-of select="TITLE"/></td>
          <td><xsl:value-of select="ARTIST"/></td>


Note: The “value-of select=” requires a field title that is case sensitive. Make sure the field in your stylesheet matches the case of the name of the field in your xml feed.

XSLT Javadoc: XssWebApi
XSLTransformationDoc: XSLTranformationDoc
XSLTransformationCache: XSLTranformationCach