XSLT macro - Cloud
Features
Uses XSLT to transform XML to HTML.
Provides backward compatibility till XSLT 1.0 version.
Supports capabilities for including data similar to other scripting macros.
Supports find and replace for adjusting the 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
Use attachments in XSLT macro editor
| Use profile in XSLT macro editor
|
Macro editor label | Default | Description |
---|---|---|
Data source | ||
Data source |
| Specify the source of the XML content to be rendered. The options available are:
|
Layout | ||
Height of iframe (in px) |
| Enter the minimum height (in px or em) to be used for the rendered content. If you do not specify, the height is auto-rendered according to the rendered content. Example: 500px |
Settings | ||
Format | html | Specify how the output is treated. The options are as follows:
|
Find regex patterns |
| Enter a comma-separated list of regex patterns to repair and modify XML prior to processing by the XSLT processor with find and replace logic. Example: (google\.dtd) |
Replacement strings |
| Enter a comma-separated list corresponding to find patterns via index position in the list. If a comma is a part of an entry, use single quotes around it. Example: http://www.google.com/$1 |
Error Level | NONE | Specify the level at which the data processing fails. If the XSLT transformer produces a message of this level or higher, this value determines the action taken by the macro. The options are:
|
Timeout in milliseconds |
| Enter time in milliseconds such that URL connections do not timeout before getting data. Use this to increase time needed for slow connections. Note that if a zero is given the connection may wait infinitely. |
File encoding | system default | Specify the encoding for an external file, if different from the system default handling. Example: UTF-8. |
Usage
Download a copy of the {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 engineParameters 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: If you omit the parameter, then the output is: |
---|
Need support? Create a request with our support team.