Description
Transforms XML to a Confluence page via an XSLT style sheet.
This macro is now included in the HTML Plugin for Confluence
Documentation
- Help available in the notation guide.
Parameters
- output - Determines how the output is formated:
- html - Data is output as a HTML (default).
- wiki - Data is output as Confluence wiki text. Use this option if you want the data to be formated by the Confluence wiki renderer.
- source - Location of source XML code. Default is the macro body.
- #filename - Data is read from the file located in confluence home directory/script/filename. Subdirectories can be specified.
- #http://... - Data is read from the URL specified.
- global page template name - Data is read from a global page template.
- space:page template name - Data is read from a space template.
- ^attachment - Data is read from an attachment to the current page.
- page^attachment - Data is read from an attachment to the page name provided.
- space:page^attachment - Data is read from an attachment to the page name provided in the space indicated.
- style - Location of source XSL code. Required if source XML is in the macro body, otherwise defaults to the macro body.
- #filename - Data is read from the file located in confluence home directory/script/filename. Subdirectories can be specified.
- #http://... - Data is read from the URL specified.
- global page template name - Data is read from a global page template.
- space:page template name - Data is read from a space template.
- ^attachment - Data is read from an attachment to the current page.
- page^attachment - Data is read from an attachment to the page name provided.
- space:page^attachment - Data is read from an attachment to the page name provided in the space indicated.
Usage
{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 not interpreted by the xslt macro are passed through to xslt
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"