Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Preview is now supported with HTML cloud 1.8.0 version

On this page

pipe
Div
idProductTOC
Table of Contents
maxLevel1
excludeOn this page
typeflat
separator
Warning

Removal notice:

Please note that the URL user and URL user password parameters were removed (see Deprecation notice: URL user and URL user password parameters). We recommend using profiles to access external data.

Table of Contents
minLevel2
maxLevel6
outlinefalse
styledefault
typelist
printabletrue

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.

Note

With this release, nested macros within the XSLT macro are supported. To make this work, select the Transformed output format macro parameter as Xhtml.

Parameters

...

Macro editor label

Default

Description

Macro

...

parameter

Transformed output format

html

Specify how the output is treated. The options are as follows:

  • html - transformed output is standard HTML.

  • xhtml - transformed output is treated as XHTML and rendered with the Confluence XHTML renderer.

  • wiki - transformed output is treated as wiki markup and rendered with the Confluence wiki renderer.

output

Profile

Enter the profile name to be transformed.

...

 Refer to profile configuration settings to know more about profiles.

...

 Contact your Confluence

...

administrator for further information about the profiles available in your instance.

profile name

Location of XML code

macro body

Enter the location of data. By default, the macro transforms the code

...

entered in the macro body.

...

  • #http://... -

...

  •  Data is read from URL. May require the user and password parameters as well.

  • ^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.

source

Location of XSL code

macro body

Enter the location of XSL code. This field becomes mandatory if source XML code is entered in the macro body. By default though, the content in macro body is considered.

...

  • #http://... -

...

  •  Data is read from URL. May require the user and password parameters as well.

  • ^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

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)

find

Replacement strings

Enter a comma separated list corresponding to find patterns via index position in list. If a comma is a part of an entry, use single quotes around it.

...

 Example: http://www.google.com/$1

replace

Error Level

NONE

Specify the level at which the data process fails. If the XSLT transformer produces a message of this level or higher, this value determines whether the action taken by the macro. The options are:

  • NONE - No action is to be taken.

  • WARNING - Display a warning about the data process; processing does not stop.

  • ERROR - Display an error and further processing is halted.

  • FATAL - Stops any further data processing.

File encoding

system default

Specify the

...

encoding for an external file, if different from the system default handling. Example: UTF-8.

encoding

User id for URL

...

connection (Removed)

Enter the user name for URL access via basic authentication.

Warning

Removal notice:

Please note that the URL user and URL user password parameters were removed (see Deprecation notice: URL user and URL user password parameters). We recommend using profiles to access external data.

user

Password for URL connection (Removed)

Enter the password for URL access via basic authentication. 

Warning

Removal notice:

Please note that the URL user and URL user password parameters were removed (see Deprecation notice: URL user and URL user password parameters). We recommend using profiles to access external data.

password

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.

timeout

XSLT Version

1.0

Select the version based on your style (XSLT) input document.

...

 This list box contains the XSLT versions that the macro is compatible with. 

xsltVersion

Only available when specifying XSLT macro via wiki markup. See Passing parameters to the XSLT engine below.

<transformer parameters>

Usage

Download a copy of the cdcatalog.xsl from https://www.w3schools.com/xml/cdcatalog.xsl and attach it to your page.

noformat
No Formatcode
{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}

Code Block
{xslt:source=^cdcatalog.xml|style=#http://www.w3schools.com/xsl/cdcatalog.xsl}
{xslt}

...

Code Block
{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 that are not interpreted by the XSLT 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 Formatcode
{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".