Div |
---|
|
On this page Table of Contents |
---|
maxLevel | 1 |
---|
exclude | On this page |
---|
type | flat |
---|
separator | pipe |
---|
|
|
Description
Excerpt |
---|
Uses XSLT to transform XML to HTML, XHTML, or wiki markup. Supports XSLT 1.0. |
Parameters
Table plus |
---|
Parameter | Default | Macro Browser Label | Description |
---|
output | html | Transformed output format | Determines how the transformed output is to be treated. - html - transformed output is standard htmlHTML.
- xhtml - transformed output is treated as xhtml XHTML and rendered with the Confluence xhtml XHTML renderer.
- wiki - transformed output is treated as wiki markup and rendered with the Confluence wiki renderer.
|
---|
source | macro body | Location of XML code | Required if style (XSLT code) is in macro body. - #filename - Data is read from the file located in confluence home directory/script/filename. Subdirectories can be specified.
- global page template name - Data is read from a global page template. Special note: How to deal with templates on Confluence 4.3 and later.
- 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 | required or macro body if source is specified | Location of XSLT 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 Confluence home directory/script/filename. Subdirectories can be specified.
- global page template name - Data is read from a global page template. Special note: How to deal with templates on Confluence 4.3 and later.
- 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.
|
---|
find |
| Find regex patterns | Comma separated list of regex patterns to use for repairing and modifying XML prior to processing by the XSLT processor with find and replace logic. HTML-68 has a bit more on this. Example: (google\.dtd) |
---|
replace |
| Replacement strings | Comma separated list corresponding to find patterns via index position in list. Single quote entries containing a comma. Example: http://www.google.com/$1 |
---|
head | false | Include head section HTML | Only in affect if clean=true. The head tag is always removed. However, setting this to true will set as true to retain all the other tags from the head section and treat them as regular body content. This is useful for retaining style information in particular. |
---|
showErrors | false | Show error message panel | XSLT transformer generated warning and errors will appear in a panel even if the transform transformer is not terminated with an error. Terminating errors automatically generate an error panel. |
---|
encoding | system default | File encoding | Encoding for an external file if different from the system default handling. Example: UTF-8. |
---|
user |
| URL user | User name for URL access via basic authentication. |
---|
password |
| URL user password | User password for URL access via basic authentication. |
---|
timeout |
| Timeout in milliseconds | URL connections may timeout before getting data. Use this to increase time needed for slow connections. Be careful using 0 for as the connection can then enter an infinite wait. |
---|
disableSecureProcessing | false | Disable secure processing feature | If authorized by your Confluence administrator to change this setting, then more powerful capabilities are available. See for details. Administrators can use CMSP to enable these more powerful capabilities. |
---|
xsltVersion | 1.0 | XSLT Version | This parameter is available with 5.4.0 version. This lists the XSLT versions the macro is compatible with. Select the version based on your style (XSLT) input document. |
---|
<transformer parameters> |
|
| Only available when specifying xslt specifying XSLT macro via wiki markup. See Passing parameters to the XSLT engine below. |
---|
|
Usage
Download a copy of the cdcatalog.xsl from https://www.w3schools.com/xml/cdcatalog.xsl and attach it to your page.
No Format |
---|
{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}
|
...
No Format |
---|
{xslt:source=xslt - basic^cdcatalog.xml|style=#http://www.w3schools.com/xsl/cdcatalog.xsl}
{xslt}
|
Anchor |
---|
| transformerParameters |
---|
| transformerParameters |
---|
|
Passing parameters to the XSLT engine
Parameters 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:
No Format |
---|
{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"
Gallery