Cookies This site keeps only what it needs to work. There is no analytics and no advertising on it today, and nothing here follows you to other sites. Read the privacy policy

Choose what to allow
+92 312 8299940Free Quote
EN – Language: English
Free tool, nothing to install

XSLT Tester Online
Run A Stylesheet On Your XML

This online XSLT processor will run an XSLT file against an XML document and show you the output right away. You can generate HTML, XML, or Text. You can even convert an XML file into a set of Java classes. All processing occurs locally, so nothing is uploaded.

  • FreePrice
  • XSLT 1.0Version
  • NoneSign-up
  • NoneUploads

XSLT Transformer

Run a stylesheet on your XML, or turn the XML into classes

Elements
0
Lines
0
Size
0 B

Ready. Add some XML and a stylesheet, or pick an example.

Your browser does all of the work here, in this tab. We upload nothing, store nothing and log nothing.
Add a link to this tool on your own site

Copy the code below and drop it into your page. It places a link to this free tool.

The short version

What An XSLT Transformer Online Does For You

XSLT is a programming language used to convert an XML file into a different form. XSLT can generate a web page, a report, or even a brand-new XML file. But it is very difficult to debug a stylesheet without being able to see what the final output looks like. So, having access to a live view of the output is incredibly helpful.

This tool shows the result at once. First, paste your XML. Then paste a stylesheet, or pick an example. Also, you can open both as files. The output appears as you type, and an HTML result also gets a preview.

The engine uses the XSLT 1.0 standard. This is what browsers and most other XML processing tools use. If you have a stylesheet that functions properly within this system, it should function correctly in your project. You can also acquire an understanding of XSLT 1.0 in a short period of time (one afternoon).

The page has another purpose as well. It can parse your XML and generate classes for Java, C#, Kotlin, TypeScript, Go, Python, PHP, Swift and Rust.

The whole transform stays inside your browser. Your XML and your stylesheet never leave your device. That matters, because XML often holds orders, prices and private feeds.

Turning XML Into HTML With XSLT

This was the function for which XSLT was initially created. Initially, a stylesheet goes through all your records to produce rows in a table. Then, you can use the sort command to arrange your records. Also, you may use a test to find records requiring action.

Drawing of an XML file and an XSLT stylesheet on the left with an arrow to an HTML table on the right
XML plus a stylesheet gives a web page.

Pick the first example and you see the idea in seconds. First, the XML holds three books. Then the stylesheet turns them into a table. Finally, the preview draws the table.

After that, you may alter the style sheet and see how the page changes. So, learning XSLT will be an easy process of making edits and then reviewing your work.

For more detail, see: MDN guide to XSLT.

XSL Transform Online With Real Templates

The testing tool includes those areas of XSLT that are used on a regular basis by many users. Users can create templates using the match attribute, the mode attribute and the priority attribute. Templates can be called by name and passed arguments.

XSLT transformer online with XML and a sorting stylesheet on the left and the transformed XML on the right
Templates, sorting and attribute value templates.

You also get the ability to use the for-each, if, choose, variables, sorting, copy, copy-of, and number features. Also, the attribute value templates feature is supported, allowing you to write and have it evaluated to produce a result.

The tool is very clear about when it doesn’t have support for a particular feature. For instance, key(), document(), and include all give the user with a message and the line number.

A Live Preview Of The Transformed XML

Also, when the result is HTML, a Preview tab appears. It draws headings, paragraphs, lists, links and tables.

XSLT transformer showing the Preview tab with a table of books sorted by price
The HTML result drawn as a table.

The preview was intentionally made basic. Scripts, styles and images are excluded from the preview, so no CSS code will execute when viewing the page. This is done to make the application secure.

XML To Java, C# And More

Then, use the second mode to convert XML to programming language. The tool reads your XML and determines which fields exist, and then creates those fields within a class. Tags that occur multiple times will be created as lists. Attributes turn into fields. Numeric data will retain its original data type.

XML to Java mode showing a library XML on the left and generated Java classes on the right
XML turned into Java classes.

After that, pick a programming language here. The programming languages available include Java, C#, Kotlin, TypeScript, Go, Python, PHP, Swift, and Rust. Copy the converted text, or save it to a file.

Parameters And Output Types

To begin, define type parameters by using a pair of name-value. If you use the same name for a parameter in your stylesheet, it will pick those parameters up. In addition, the output tag will work out whether the result is HTML, XML or Text.

XSLT transformer with a text output stylesheet and a parameter, showing a plain text price list
A text report with a parameter.

The resulting file is saved with the correct extension, e.g., if you created an HTML document it will be saved as a.html file.

A Short XSLT Cheat Sheet

A template is identified by "xsl:template". The match attribute specifies which nodes are handled by the template. For example, "match=’book’" will apply to all books.

With xsl:apply-templates, each node is sent to its template. Conversely, xsl:for-each processes a list in place. Each of these can be sorted using xsl:sort.

Also, xsl:value-of produces output in the form of text. On the other hand, xsl:if and xsl:choose are used for decision making. Lastly, xsl:copy-of produces a copy of an entire branch of the input document.

An attribute value wrapped in curly braces runs XPath. An example of this is id="{@id}" which will write out the id of the current node.

Safe By Design

We wrote the engine by hand. At no point does it call eval, nor does it hand your XML to the browser as markup. Also, the engine does not expand entities from a DOCTYPE; so, entity attacks can’t take place.

A guard prevents stylesheets from looping continuously. Rather than having the page freeze, this tool will let you know what is causing problems.

Video guide

A Quick Walkthrough of the XSLT Tester

This brief video shows each step from start to finish. Choose your language below, and switch on captions if they help.

How it works

Using The XSLT Tester, Step By Step

Four steps take you from XML and a stylesheet to a finished result.

  • Add your XML

    Paste it, open a file, or load an example. Errors show the line.

  • Add a stylesheet

    Paste your XSLT here, or select an example and make changes to it. Each time you type a letter, the display will be updated.

  • Read the result

    Look at the code, and for the HTML part, you will want to use the preview tab. All of your notes and messages can be found below.

  • Copy or save

    Copy the result, or save it with the right file type.

Why this one

What This XSLT Tester Does Differently

Plenty of online tools send your files off to a server. These are the extras.

  • Runs in your tab

    Your XML and your stylesheet never leave your device.

  • Real XSLT 1.0

    In addition to its own XPath engine, templates, modes, sorting, parameters and attribute value templates.

  • Safe preview

    HTML results are drawn node by node, so no script or style can run.

  • Clear errors

    Bad XML, bad XPath and unsupported tags all give a message with a line.

  • XML to classes

    Write Java, C#, Kotlin, TypeScript, Go, Python, PHP, Swift or Rust from any XML.

  • Examples to learn from

    Four ready stylesheets show tables, templates, identity copy and text reports.

Good habits

Habits For Writing Better Stylesheets

Small habits make XSLT easier to read and to fix.

  • Begin with a template for the root. A template with match="/" sets the shape of the whole result.
  • Prefer templates to loops. apply-templates keeps each rule small. Loops pile everything in one place.
  • Name your output. Add xsl:output with a method. Then HTML, XML and text come out right.
  • Use variables for repeats. If you type the same path twice, keep it in a variable.
  • Sort with xsl:sort. Set data-type to number for numbers. If you skip this, 10 is sorted ahead of 2.
  • Use attribute value templates. Write class="{@lang}" instead of a long xsl:attribute block.
  • Start from the identity template. Copy everything first, then override only what must change.
  • Test with small XML. Three records show most bugs. Big files hide them.
  • Mind the whitespace. Use xsl:text for spaces and line breaks that you need to keep.
  • Check XPath separately. If a select returns nothing, test it in the XPath tester first.
  • Keep stylesheets in version control. A minor modification can ruin a template. Earlier run info is readily available through the history list.
Worth avoiding

Common XSLT Mistakes This Tool Helps You Spot

Each of these gives an empty or wrong result. The tester makes them visible.

  • Missing a template for the root

    The tester will notify you if there are no matches, and the default templates only output text without the match="/".

  • Forgetting the xsl: prefix

    Tags without the prefix go to the output as plain text, not as code.

  • Text sorted as text

    Without data-type="number", the value 10 sorts before 2.

  • Wrong output method

    XML-based HTML pages often close their tags in unusual ways. If you wish to use an HTML output method in your stylesheet, then change the value of the ’output’ attribute.

  • Endless recursion

    A template that calls itself forever stops with a clear message.

Questions

XSLT Transformer Questions People Ask

Is this XSLT transformer online free?

Yes. You pay nothing, you need no account, and there’s no cap. Your browser does the heavy lifting, so we have no server bill to recover from you.

Are the XML and XSL files sent to a server?

No, your browser will read both the XML file and the stylesheet file, then write the resulting output. The output does not go to this website nor does this website retain any info. Once you close the tab, all evidence of what you did will disappear.

What version of XSLT does it run?

XSLT 1.0 with XPath 1.0. It is the version built into browsers and many tools. Newer features such as XSLT 2.0 sequences do not exist here.

How do I turn XML into HTML?

Write a root-level template that produces HTML tags, then use a for-each loop to output each record. Set the output-method property of your stylesheet to "html". This first example illustrates how this can be accomplished.

What if my stylesheet uses key() or include?

The tool doesn’t handle these tags. The tool will let you know what tag has an issue and the location in the file. Often, you may be able to substitute key() with a predicate.

Can I pass parameters?

Type name=value pairs into the Parameters box. An xsl:param element that is at the highest level of your XSLT document will pick up the value.

Why does my XSLT transform return an empty result?

Usually no template matches the root, or the select finds nothing. Check match="/" and test the XPath on its own.

Why does the preview look unstyled?

The preview will show you only the structure and the content of the page. All of the other elements such as CSS, script, and images have been left off so that your browser remains secure.

What does the XML to code mode do?

It reads your XML and writes classes. Repeated tags become lists, attributes become fields and numbers keep their type.

What output formats can this XSLT tool produce?

Java, C#, Kotlin, TypeScript, Go, Python, PHP, Swift and Rust.

How does it protect against XML attacks?

It will not expand any DOCTYPE entities and so cannot support "entity bombs" or "external entities". In addition, it limits the size of the transforms that it processes.

Can I save the transformed output as a file?

Yes. Use Download file. Results will be saved as either.html for an HTML result,.txt for a Text result or.xml for an XML result.

How large a file will it accept?

A few megabytes. Very large files or heavy templates may stop with a message instead of freezing the page.

How do these differ apply-templates and for-each?

Apply-templates applies the template that is most appropriate for each node. For-each applies the same section of code to every node as it is found within the document. It is generally easier to use templates when you plan on using your code multiple times. But for-each is often faster to develop.

Can I apply more than one stylesheet?

Since the tool can’t import or include, you should put each of your templates into a single style sheet.

Does it run on phones too, or only on desktops?

Yes. The panels stack and the boxes scroll. For long stylesheets, a keyboard is still easier.

More free tools

Handy Companions For XML Work

The transform is one step. These three tools handle the steps around it.

Ready To Transform Some XML?

Once you paste your XML and your stylesheet, you will be able to view the output. The transformer is for free, needs no registration, and processes all of your data locally.

Prefer Denwix on GoogleReview Denwix on Google