Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Teams
, (opens new window)

HTML for Confluence
Results will update as you type.
  • Overview
  • Installation
  • Get started
    • User guide - 5.x
    • User guide - Cloud
      • HTML macro - Cloud
      • XSLT macro - Cloud
    • Differences between HTML Macro for Confluence and HTML for Confluence
  • Tutorials
  • Migration
  • Release notes
  • Help and support
  • Miscellaneous
    You‘re viewing this with anonymous access, so some content might be blocked.
    /
    XSLT macro - Cloud
    Updated 16h ago

    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

    Macro editor label

    Default

    Description

    Data source

    Data source

     

    Specify the source of the XML content to be rendered. The options available are:

    • XML embed code: Enter XML code to display content. If this option is selected, a code block section appears where you can enter customized XML code to be displayed. 

      • To add XSL code click “Click here to add/edit xsl source” and enter XSL code.

    • URL: If this option is selected, a URL parameter is displayed. Enter the URL of the required source from which the XML content is to be displayed on the page.

      • To add XSL URL click “Click here to add/edit xsl source” and enter the URL of the XSL content.

    • Profile: Select a profile to access the required source for XML content. Refer to this link to know more about profiles. Contact your Confluence administrator for further information about the profiles available in your instance.

      • To add XSL profile click “Click here to add/edit xsl source” and enter the profile for the XSL content.

    • Attachment: Specify the attachment whose XML content is to be rendered. By default, if selected, Space and Page show the current space and page, respectively, and you can select an attachment available on this page. The following parameters are shown:

      • Space: Data is read from an attachment to the page name provided in the space indicated.

      • Page: Data is read from an attachment to the page name provided.

      • Attachment: Data is read from an attachment to the current page.

      • To add XSL attachment click “Click here to add/edit xsl source” and select the XSL attachment similar way.

    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.
    If you specify the height, the rendered content fits within the specified height. If the content exceeds the specified height, a scroll bar is displayed that lets you scroll through the content.

    Example: 500px

    Settings

    Format

    html

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

    • html - transformed output is standard HTML

    • XHTML and wiki support are removed from 3.0.0 version of app.

    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:

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

    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 cdcatalog.xsl from https://www.w3schools.com/xml/cdcatalog.xsl and attach it to your page.

    {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 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: The value of winnersOnly is "lala".

    If you omit the parameter, then the output is: The value of winnersOnly is "no".

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

    {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 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: The value of winnersOnly is "lala".

    If you omit the parameter, then the output is: The value of winnersOnly is "no".

    Need support? Create a request with our support team.

    Copyright © 2005 - 2025 Appfire | All rights reserved.

    {"serverDuration": 15, "requestCorrelationId": "61e585fbc7ff47768dbe5aa8ecd5d7da"}