...
...
...
...
...
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
On this page
|
Description
...
Features
- Uses XSLT to transform XML to HTML, XHTML, or wiki markup. Supports XSLT 1.0.
- Supports working with XSL parameters; only available with wiki output format. See Passing parameters to the XSLT engine section.
- Supports security restrictions as described in Macro Security for Confluence.
- Supports capabilities for including data similar to other scripting macros.
- Supports find and replace for adjusting resulting output.
Info |
---|
|
Parameters
Table plus | |||
---|---|---|---|
Parameter | Default | Macro Browser Label | Description | output | html | Transformed output format |
Tip | ||
---|---|---|
| ||
Paste the file link into your browser's address bar. If the actual XML code is displayed in the browser, it is considered to be invalid or in an incorrect format. If the file downloads to your system, the macro can process the file and its contents. |
If you want to specify a URL in the Location parameters, make sure that only a raw URL is provided. A raw URL is defined as the part of the URL following the domain information and includes the query string, if present. For example, in the URL string http://www.contoso.com/articles/recent.aspx, the raw URL is /articles/recent.aspx.
Parameters
Macro Browser Label | Default | Description | Macro Parameter |
---|---|---|---|
Transformed output format | html | Specify how the output is treated. The options are as follows:
|
...
|
...
|
...
| output | ||||
Profile | Enter the profile name to access the files to be transformed. Profiles contain a basic set of parameters used to access a remote location such as the type of URL, user credentials, and so on. Refer to this link to know more about profile configuration and this link for tutorials.
| profile | |||
Location of XML code |
...
macro body | Enter the location of XML data. By default, the macro transforms the code entered in the macro body.
|
...
|
...
|
...
|
...
required or
macro body if source is specified
...
| 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 XSL content in macro body is considered.
|
...
|
...
|
...
|
...
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. |
...
Refer to this article for more information about regular expressions. Example: (google\.dtd) |
...
find |
Replacement strings |
...
Enter a comma-separated list |
...
of positions to |
...
search for patterns |
...
in the output content. Note that the positions are indexed beginning at "1". If a comma is a part of an entry, use single quotes around it. Example: http://www.google.com/$1 |
...
replace |
...
Include head section HTML |
...
false | Enable this option to retain all the other tags from the |
...
header section and treat them as regular body content. This is useful for retaining style information in particular. By default, the head tag is always removed. |
...
head | |
Show error message panel | false |
...
Displays the XSL transformer generated warning and errors |
...
in a panel even if the |
...
transformation is not terminated with an error. Terminating errors automatically generate an error panel. | showErrors | ||
Error level | NONE | Specify the level at which the data process fails. The selected level determines how the XSLT macro handles data processing errors. The options are:
| |
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 |
...
Enter the user name to be used for URL access |
...
to XML and XSL files. |
...
user |
Password for URL |
...
connection | Enter the user password to be used for URL access |
...
to XML and XSL files. |
...
password |
Timeout in milliseconds |
...
Enter time in milliseconds to wait until the URL connection times out before getting data. Use this to increase time needed for slow connections. |
...
Note that if a zero is given, the connection may wait indefinitely. | timeout | |
Disable secure processing feature | false | Enable this option to disable secure processing of XML and XSL files. If authorized by your Confluence administrator to change this setting, |
...
more powerful capabilities are available. See
| disableSecureProcessing |
...
XSLT Version | 1.0 |
...
Select the version based on your style (XSLT) input document. This drop-down contains the XSLT versions that the macro is compatible with. Available since 5.4.0 version |
...
. | xsltVersion |
Info | ||
---|---|---|
| ||
|
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} |
...
Anchor | ||||
---|---|---|---|---|
|
Passing parameters to the XSLT engine
Parameters not interpreted by the
...
XSLT macro are passed through to
...
XSLT. You must use wiki
...
syntax to take advantage of this.
The following example is 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 of the code is: The value of winnersOnly is "lala"
If you omit the parameter tag,
...
the output shown is: The value of winnersOnly is "no"
Anchor #html_57_helpfulResources #html_57_helpfulResources
Helpful resources
#html_57_helpfulResources | |
#html_57_helpfulResources |
- Profiles in the Configuration screen
- Key concepts to understand how to link and render XML content from other sources
Gallery