XSL Transform provider

This provider is the default rendering provider of the XML module.
It takes the XML from the Xml data provider and runs a XSL transformation.

The XSL-Script can either be a file on your server or it can be retrieved per Http Request from a given Url. Usually you will use choose the file option.

The provider uses System.Xml.Xsl.XslCompiledTransform for transformation.

Parameters

You can pass in additional parameters into the transformation, which can be defined with the parameter editor.
Parameters can be dynamic, for example

parameterEditor.jpg
This will result in following parameters:
userName -> holds the username of the current user
xmlParameter -> holds the content of the querystring parameter with the name queryStringParameter.
(if the url ends like ?querystringparameter=xmlmodule, it will hold xmlmodule

These parameters can be used inside the XSLT script:
<xsl:param name ="userName"  />
<xsl:param name ="xmlParameter" select ="No Parameter"/>
In this case, the param xmlParameter will have the value No Parameter if no value was passed in.

Extension object

A new Extension object gets added to the transformation and allows the following actions:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:dnnx="http://www.dotnetnuke.com/xml" extension-element-prefixes ="dnnx">
  <xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
  
  <xsl:template match="*" >
    <!-- Sets page title -->
    <xsl:apply-templates select ="dnnx:setPageTitle('New Page Title')" />
    
    <!-- Sets page description -->
    <xsl:apply-templates select ="dnnx:setPageDescription('This will make SEO easier')" />
    
    <!-- Sets module title -->
    <xsl:apply-templates select ="dnnx:setModuleTitle('New Module Title')" />

    <!-- Register a css file inside header-->
    <xsl:apply-templates select ="dnnx:registerStyleSheet('/portals/0/important.css')" />

    <!-- Register a javascript file inside header-->
    <xsl:apply-templates select ="dnnx:registerClientScriptInclude('frameworkX', '/path/to/javascript.js')" />

    <!-- Register a javascriptBlock-->
    <xsl:variable name="script1">
      <script type="text/javascript">
        ...
      </script>
    </xsl:variable>
    <xsl:apply-templates select ="dnnx:registerClientScriptBlock('anId', @script1)" />

    <!-- Retrieves a value with token replace -->
    <xsl:value-of select ="dnnx:tokenReplace('[user:username]')"/>
    
  </xsl:template>
</xsl:stylesheet>

DTD handling

By default XslCompiledTransform prohibits the use of DTDs inside scripts. This can be changed inside the provider section within web.config.

Last edited Mar 23, 2011 at 7:20 PM by SCullmann, version 10