---
title: "How to render wiki from XML or XSL files"
canonical: "https://support.appfire.com/space/HTML/70617295/How%20to%20render%20wiki%20from%20XML%20or%20XSL%20files"
format: markdown
---
> Macro (aura-html)

<span style="color: #000000">This article provides an overview on how to render wiki markup through an </span><span style="color: #000000">*XSLT*</span><span style="color: #000000"> macro. </span><span style="color: #000000">It is recommended to embed another macro that gives a wiki markup output inside the </span><span style="color: #000000">*XSLT*</span><span style="color: #000000"> macro to get the optimal result.</span>

## <span style="color: #000000">Before you begin</span>

- <span style="color: #000000">Ensure that the URLs for the XML and XSL files are in the raw format. 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 </span>`http://www.contoso.com/articles/recent.aspx`<span style="color: #000000">, the raw URL is </span>`/articles/recent.aspx`<span style="color: #000000">.</span>
- <span style="color: #000000">The XML and XSL files must be in the correct format and valid files. </span>

> ✅ ### How to identify if XML/XSL files are valid for the macro?
> ✅ 
> ✅ <span style="color: #000000">Paste the file link into your browser's address bar. If the actual XML or XSL 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.</span>

## Steps

<span style="color: #000000">For this example</span><span style="color: #000000">,</span><span style="color: #000000"> let's assume that:</span>

- <span style="color: #000000">The XML file to be rendered is available on the Home page in the same space.</span>
- <span style="color: #000000">The XSL code is entered directly in the macro body.</span>
- <span style="color: #000000">A profile is not specified and direct URLs are mentioned in the </span><span style="color: #000000">*Location of XML data*</span><span style="color: #000000"> parameter. </span>

> ⚠️ <span style="color: #000000">These assumptions are made for this example. The basic premise of the example is that the XML file to be rendered must be attached to a page in the same space. You can replace the given XML and XSL files as required from your instance. However, you can also specify a profile and provide the relative paths to the XML and XSL files in the macro as well. For more information, visit the links in the </span><span style="color: #000000">[Helpful resources](#HowtorenderwikifromXMLorXSLfiles-html_57_tutl_wikiXslt_addlInfo)</span><span style="color: #000000"> section.</span>

### <span style="color: #000000">Define these parameters/values</span>

| <span style="color: #000000">**Transformed output format**</span> | <span style="color: #000000">*wiki*</span> |
| --- | --- |
| <span style="color: #000000">***Location of XML code***</span> | `Home^animals.xml` |
| <span style="color: #000000">***Location of XSL code***</span> | <span style="color: #000000">blank</span> |

### Contents of XSL file

<span style="color: #000000">The following code is given in the macro body:</span>

```xml
<!-- <?xml version="1.0" encoding="UTF-8"?> this causes problems when loading without editor --> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" /> 
<xsl:template match="/"> h2. Animals 
{csv:output=wiki} Name, Type, Breed, Color 
<xsl:for-each select="animals/animal"> 
<xsl:value-of select="name"/>, <xsl:value-of select="type"/>, <xsl:value-of select="breed"/>, 
<xsl:value-of select="color"/>, "[www.google.com]" 
</xsl:for-each> 
{csv} 
</xsl:template> 
</xsl:stylesheet>
```

> ℹ️ <span style="color: #000000">In the given XSL code:</span>
> ℹ️ 
> ℹ️ - <span style="color: #000000">There is a </span><span style="color: #000000">*CSV*</span><span style="color: #000000"> macro embedded with a wiki output format.</span>
> ℹ️ - <span style="color: #000000">The </span><span style="color: #000000">*CSV*</span><span style="color: #000000"> macro ensures that the XSL code reads data from the specified XML file and transforms it into wiki markup.</span>
> ℹ️ - <span style="color: #000000">This markup is then displayed using the </span><span style="color: #000000">*XSLT*</span><span style="color: #000000"> macro on the page.</span>
> ℹ️ - <span style="color: #000000">The </span>`h2. Animals`<span style="color: #000000"> code is wiki markup that is </span><span style="color: #000000">*outside*</span><span style="color: #000000"> the </span><span style="color: #000000">*CSV*</span><span style="color: #000000"> macro contents. Thus, though you can directly provide wiki markup in the XSL code itself, it is recommended to use embedded macros with wiki output format to get the desired output.</span>

### <span style="color: #000000">Contents of XML file</span>

```
<?xml version="1.0" encoding="UTF-8"?>
<animals>
    <animal>
        <type>dog</type>
        <name>King</name>
        <breed>Border Collie</breed>
        <color>black and white</color>
    </animal>
    <animal>
        <type>cat</type>
        <name>Irene</name>
        <breed>Long hair mix</breed>
        <color>mixed</color>
    </animal>
</animals>
```

### <span style="color: #000000">P</span><span style="color: #000000">arameters set in the macro editor</span>

![Image shows the macro editor parameters set.](media://56380a96-d8f9-44a7-a72d-38d724e6a0b6)

## <span style="color: #000000">Result</span>

![Image shows the result after the page published.](media://b7d4b9e5-6305-490e-a609-79c58c49ec9a)

## > Macro (anchor)

<span style="color: #000000">Helpful resources</span>

- <span style="color: #000000">[XSLT macro](https://appfire.atlassian.net/wiki/x/g4g1B)</span>
- <span style="color: #000000">[How to use URLs?](https://appfire.atlassian.net/wiki/x/5IQ1B)</span>
- <span style="color: #000000">[Profile configuration](https://appfire.atlassian.net/wiki/x/l4E1B#Configuration-html_57_config_profiles)</span><span style="color: #000000"> </span>
- <span style="color: #000000">[Create a profile with URL](https://appfire.atlassian.net/wiki/x/94Q1B)</span>