FormatterHQ

XML XSL Transform

Paste an XML document on the left and an XSLT stylesheet on the right to see the transformed result instantly: HTML with a rendered preview, XML, or plain text such as CSV.

Original
Changed
Output HTML
Ready.

How to use the XML XSL Transform

  1. Paste the XML document into the left editor and the XSL stylesheet into the right editor, or click Sample for a catalog and a table stylesheet.
  2. Set the output type in the stylesheet with <xsl:output method="html"/>, "xml" or "text".
  3. Click Transform; with Auto update on, the result refreshes as you edit either side.
  4. For HTML output, check the Preview tab; use Code to copy or download the raw result.

Run an XSL transform in your browser

XSLT turns XML into something else: an HTML report, a differently shaped XML document, or plain text like CSV. Testing a stylesheet usually means running a command-line processor or a build step after every change. This XSL transform page runs it live: edit the XML on the left or the stylesheet on the right and the output updates as you type.

Two processors

When your browser provides the standard XSLTProcessor API, it is used, and the status bar reads Transformed with the browser XSLT processor (html output) or similar. If the API is missing or fails, a compact XSLT 1.0 interpreter built into the page takes over and the message says "built-in" instead. Browser processors implement XSLT 1.0, so XSLT 2.0 and 3.0 features such as xsl:for-each-group or xsl:function are not supported. They need a processor such as Saxon.

Example: XML to CSV with method="text"

Left editor:

<orders>
  <order id="7" total="19.50"/>
  <order id="8" total="5.00"/>
</orders>

Right editor:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="text"/>
  <xsl:template match="/">id,total<xsl:text>&#xA;</xsl:text>
    <xsl:for-each select="orders/order">
      <xsl:value-of select="concat(@id, ',', @total)"/>
      <xsl:text>&#xA;</xsl:text>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

Output:

id,total
7,19.50
8,5.00

Note the <xsl:text>&#xA;</xsl:text> for line breaks: whitespace-only text between instructions is ignored in a stylesheet, so newlines must be written explicitly. The same pattern produces SQL INSERT statements, fixed-width reports or Markdown tables.

Output methods

xsl:output methodWhat you get
htmlHTML markup in the Code tab plus a rendered Preview tab.
xmlAn XML document, formatted with the Indent you choose.
textPlain text only: CSV, SQL statements, Markdown, configuration lines.
(not set)HTML if the result's root element is <html>, otherwise XML.

The Sample uses method="html": it sorts the books by price with <xsl:sort select="price" data-type="number"/> and renders them as a table you can see in the Preview tab.

What the built-in processor covers

The fallback interpreter handles the everyday XSLT 1.0 toolkit: template matching with modes and priorities, apply-templates, call-template with parameters, for-each, value-of, if, choose, xsl:sort, variable and param, element, attribute, copy, copy-of and attribute value templates like href="{@url}". An instruction it does not know inside a template stops with a clear message such as xsl:for-each-group is not supported by the built-in XSLT processor. Top-level declarations other than templates, variables, parameters and xsl:output are skipped without a message, including xsl:import, xsl:include, xsl:strip-space and xsl:key, and xsl:number always writes plain decimal numbers, whatever its format says.

Troubleshooting

  • "Paste the XML document in the left editor" – one of the two editors is empty.
  • Invalid XSL – the stylesheet itself must be well-formed XML; the error names the line and column.
  • Empty output – usually a namespace mismatch. If the source has a default namespace, declare it with a prefix in the stylesheet and use that prefix in match and select.
  • Only text, no tags – no template matched, so XSLT's built-in rules copied the text content. Check your match patterns.

To debug a select expression on its own, try it in the XPath tester. If you just need a quick conversion without writing a stylesheet, XML to CSV and XML to HTML do it with no XSLT at all.

Privacy

Both documents are transformed in your browser and are not uploaded. Only Save & Share sends them to our server, to create a shareable link.

Frequently asked questions

Does this support XSLT 2.0 or 3.0?
No. Browsers implement XSLT 1.0, and so does the built-in fallback. Stylesheets that use XSLT 2.0 features like for-each-group, regular expressions or user-defined functions need a processor such as Saxon.
Why does the output show no HTML preview?
The Preview tab appears only when the result is HTML. Set in the stylesheet, or make the root element of the result.
Why do I get my text content but none of my tags?
No template matched the input, so XSLT applied its built-in rules, which output text nodes only. This is often caused by a default namespace in the XML that the stylesheet does not declare.
Can I pass parameters to the stylesheet?
There is no separate field for parameters. Set a default value on the top-level in the stylesheet and edit it there while testing.
Can the stylesheet load other files with xsl:import or document()?
Rely on a single self-contained stylesheet. Imports, includes and document() calls refer to other files that the page cannot reach, so they are not a reliable way to test here.

Last updated October 3, 2026

Related tools