Xsltproc – It is a Unix/Linux command line tool to transform the XML file into an Html or XML file.
# xsltproc [OPTIONS] stylesheet-file input-xml-file
# xsltproc - -output books.html books.xsl books.xml
<books> <book price="$35" author="Kathy Sierra">The Head First EJB</book> <book price="$18" author="Martin Fowler">UML Distilled </book> <book price="$27" author="Bill Dudney">Mastering Java Server Faces </book> </books>
<html> <head></head> <body> <div id="books"> <ul> <li><b>The Head First EJB:</b> $35 : Kathy Sierra</li> <li><b>UML Distilled: $18 :</b> Martin Fowler </li> <li><b>Mastering Java Server Faces:</b> $27 : Bill Dudney </li> </ul> </div> <body> </html>
<?xml version="1.0"?>
<!-- Include this tag, so that it will be identified as a XSL stylesheet -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--This tag tells that the output should be transformed into Html-->
<xsl:output method="html"/>
<!-- This template processes the root node i.e / -->
<xsl:template match="/">
<html>
<head>
<title>My Favourite Books</title>
</head>
<body>
<div id="books">
<ul>
<!-- Apply a template to process each book tag -->
<xsl:apply-templates select="books/book"/>
</ul>
</div>
</body>
</html>
</xsl:template>
<!-- Template to process book tag -->
<xsl:template match="book">
<li>
<!-- Get the value of the text node -->
<b><xsl:value-of select="." /> :</b>
<!-- Get the value of the price attribute -->
<xsl:value-of select="@price" /> :
<!-- Get the value of the author attribute -->
<xsl:value-of select="@author" />
</li>
</xsl:template>
</xsl:stylesheet>