This document covers all of the basic functionality of the XML/XSL module. Once you have completed the ten simple steps listed below, you will have learned to use the basic features of the XML/XSL module. Each step builds on the preceding one, so be sure to finish each step before continuing.
0. Initial Preperation
Create a new tab xmltest and add a new xml module to it.
1. Check xsl transformation is working
Go to
Edit XML/XSL Options,
1.1. Create and save the XML source file
<xml/>
Enter the text directly above and save it as Text.xml. Upload it as
XML Source.
1.2. Create and save the XSL file
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="MyArg"/>
<xsl:template match="xml">
<b>Hello World
<xsl:if test="$MyArg">, <xsl:value-of select="$MyArg"/></xsl:if>
</b>
</xsl:template>
</xsl:stylesheet>
Enter the text listed directly above and save it as test.xsl. Upload it as XSL Source.
1.3. Save the XML settings
After the XML settings are saved, a bold "Hello World" should appear.
2. Test the Static XSL Parameter
Open Edit XML/XSL Options, add a new XSL parameter MyArg, type Static Value, value = "welcome to the XML/XSL Module"
Save the parameter first, then save settings.
The result should be "Hello World, welcome to the XML/XSL Module"
3. Test the Search Functionality
Open Edit XML/XSL Options, Advanced Options.
Set Allow Indexing to "only on next run". Save settings.
Perform a Index Run using Host->Search Admin->Re-index Content.
Search for "welcome", your XML module should appear in the search result.
4. Clear the Search
Open Edit XML/XSL Options, Advanced Options.
Allow Indexing should be set to "never". Your module is still inside the dnn index.
Click on Clear Search Index to remove it. Search for "welcome" again, your module should not appear again on the result page.
5. User Specific Parameter
Open Edit XML/XSL Options again, go to Advanced Options again.
Set Allow Indexing to "Always". Go back to the XSL-Settings, and alter the type of the MyArg parameter to User's Name. Save the parameter first.
Go to Advanced Settings ->Allow Indexing should be set on never as the result now depends on the current user. Save settings.
The result should be "Hello World, Admin" (or whoever you are logged in as).
6. Querystring passthrough
Open Edit XML/XSL Options again, go the XSL parameter and alter the type of "MyArg" to "Pass-Through Query String".
Enter "qparam" in the value field. Save parameter and update.
Output should be "Hello World".
Alter the calling URLand add a qparam querystring, for example: http://localhost/DotNetNuke3/udt/tabid/53/Default.aspx?qparam=My Friend
Output should be "Hello World, My Friend"
7. Test output as text file
Open Edit XML/XSL Options again, go to Advanced Options and set output type to as "link to a download".
Set Content type to "*.txt(text/plain)". Save.
Click on Download. This should result in the plain text containing "<b>Hello World</b>"
8. Test output as xml file
Open Edit XML/XSL Options again, go to Advanced Options and set output type to as "link to a download". Set Content type to "*.xml (text/xml)". Save. Click on Download. This should result in a xml output "<b>Hello World</b>"
Copy the actual url into your clipboard, it will be needed in step 9.
Alter the adress, add the querystring parameter qparam again. Note that it changes the xml result.
9. Working with a http source
!!!! This exercise is for demonstration purposes, it is not meant to be a practical XML application or real world example
!!!! Please don't queue XML modules in production
Add a new page/tab, add a new XMLmodule inside. Open Edit XML/XSLOptions again, and paste the address from step 8 as xml source!
Upload the following as test2.xsl as your xsl script:
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="/">
<xsl:value-of select="b"/>
</xsl:template>
</xsl:stylesheet>
Save settings, result should be a unbolded "Hello world".
10. Working with dynamic http sources.
!!!! This exercise is for demonstration purposes, it is not meant to be a practical XML application or real world example
!!!! Please don't queue XML modules in production
Open Edit XML/XSL Options again, add a querystring parameter for the xml source. Name it qparam. Set the Data Origin to User's Name. Save settings.
The result should be "Hello World, Admin" (or whoever you are logged in as).