On this page
Features
- Uses XSLT to transform XML to HTML, XHTML, or wiki markup.
- Provides backward compatibility till XSLT 1.0 version.
- Supports capabilities for including data similar to other scripting macros.
- Supports find and replace for adjusting resulting output.
- Allows administrators to restrict the usage of Javascript in the XSLT macro (based on Allow JavaScript in Configuration settings). The Confluence page throws a rendering error if this parameter is not enabled, and Javascript is inserted while using the macro.
Parameters
Usage
Download a copy of the cdcatalog.xsl from https://www.w3schools.com/xml/cdcatalog.xsl and attach it to your page.
{xslt:style=^cdcatalog.xsl} <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> </cd> <cd> <title>Maggie May</title> <artist>Rod Stewart</artist> <country>UK</country> </cd> </catalog> {xslt}
{xslt:source=^cdcatalog.xml|style=#http://www.w3schools.com/xsl/cdcatalog.xsl} {xslt}
{xslt:source=xslt - basic^cdcatalog.xml|style=#http://www.w3schools.com/xsl/cdcatalog.xsl} {xslt}
Passing parameters to the XSLT engine
Parameters that are not interpreted by the XSLT macro are passed through to XSLT. You must use wiki macro syntax to take advantage of this.
Consider the following example provided by Johan Nagels:
{xslt:output=wiki|source=Home^snippets.xml|winnersOnly=lala} <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:param name="winnersOnly">no</xsl:param> <xsl:output method="html"/> <xsl:template match="/"> The value of winnersOnly is "<xsl:value-of select="$winnersOnly"/>" </xsl:template> </xsl:stylesheet>{xslt}
The output is: The value of winnersOnly is "lala".
If you omit the parameter, then the output is: The value of winnersOnly is "no".