Skip to end of banner
Go to start of banner

XSLT Macro - Cloud

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

On this page

Description

Uses XSLT to transform XML to HTML, XHTML, or wiki markup. Supports XSLT 1.0.

Parameters

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 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"

Gallery

  • No labels