XSL Transformer - XSLT

This XSL Transformer (XSLT) let's you transform an XML file using an XSL (EXtensible Stylesheet Language) file. You can also chose your indentation level.

The XSL Transformer fully supports XML namespaces, but the declarations MUST be explicit and MUST be on the root XML element of both your XML file and your XSL file. See the XSLT Examples section for details.

There is no limit to the file you can upload but be patient with big or huge files.

XML Input

Option 1: Copy-paste your XML string here
Option 2: Or type in the URL to your XML file

XSL Input

Option 1: Copy-paste your XSL string here
Option 2: Or type in the URL to your XSL file
Indentation level:
Force output to new window:

XSLT Example

If you want to learn more about XSLT, I suggest you check out W3Schools.com. The following example shows some very basic XSLT functionalities and the usage of namespaces.

XML File:

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog xmlns:foo="http://www.foo.org/" xmlns:bar="http://www.bar.org">
	<foo:cd>
		<title>Empire Burlesque</title>
		<artist>Bob Dylan</artist>
		<country>USA</country>
		<company>Columbia</company>
		<price>10.90</price>
		<bar:year>1985</bar:year>
	</foo:cd>
	<foo:cd>
		<title>Hide your heart</title>
		<artist>Bonnie Tyler</artist>
		<country>UK</country>
		<company>CBS Records</company>
		<price>9.90</price>
		<bar:year>1988</bar:year>
	</foo:cd>
	<foo:cd>
		<title>Greatest Hits</title>
		<artist>Dolly Parton</artist>
		<country>USA</country>
		<company>RCA</company>
		<price>9.90</price>
		<bar:year>1982</bar:year>
	</foo:cd>
</catalog>

XSL File:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:foo="http://www.foo.org/" xmlns:bar="http://www.bar.org">
<xsl:template match="/">
  <html>
  <body>
  <h2>My CD Collection</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>Title</th>
        <th>Artist</th>
        <th>Country</th>
        <th>Company</th>
        <th>Price</th>
        <th>Year</th>
      </tr>
      <xsl:for-each select="catalog/foo:cd">
      <tr>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="artist"/></td>
        <td><xsl:value-of select="country"/></td>
        <td><xsl:value-of select="company"/></td>
        <td><xsl:value-of select="price"/></td>
        <td><xsl:value-of select="bar:year"/></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

Transformed XML:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:bar="http://www.bar.org" xmlns:foo="http://www.foo.org/">
   <body>
      <h2>My CD Collection</h2>
      <table border="1">
         <tr bgcolor="#9acd32">
            <th>Title</th>
            <th>Artist</th>
            <th>Country</th>
            <th>Company</th>
            <th>Price</th>
            <th>Year</th>
         </tr>
         <tr>
            <td>Empire Burlesque</td>
            <td>Bob Dylan</td>
            <td>USA</td>
            <td>Columbia</td>
            <td>10.90</td>
            <td>1985</td>
         </tr>
         <tr>
            <td>Hide your heart</td>
            <td>Bonnie Tyler</td>
            <td>UK</td>
            <td>CBS Records</td>
            <td>9.90</td>
            <td>1988</td>
         </tr>
         <tr>
            <td>Greatest Hits</td>
            <td>Dolly Parton</td>
            <td>USA</td>
            <td>RCA</td>
            <td>9.90</td>
            <td>1982</td>
         </tr>
      </table>
   </body>
</html>