XSLT is and acronym for EXtensible Stylesheet Language Transformations.
Here is my example. Consider the XML-file music.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="music.xsl"?>
<archive>
<album>
<artist>Almand, Jim</artist>
<title>Between The Lines</title>
<date>1997</date>
<track seconds="210">Take it from Me</track>
<track seconds="275">Let's go to Town</track>
<track seconds="196">Sweet Summer Rain</track>
</album>
<album>
<artist>Hoffman, Seth</artist>
<title>Days Go By</title>
<date>2001</date>
<track seconds="156">Purple Flowers</track>
<track seconds="259">And the Lord Said</track>
<track seconds="234">Days Go By</track>
<track seconds="376">Gingerbread Porcupine</track>
</album>
</archive>
And the XSL-file music.xsl (which, is also an XML-file):
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:transform version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="/">
<html>
<head>
<title>Archive</title>
<link rel="stylesheet" type="text/css" href="music.css"/>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="album">
<h2><xsl:value-of select="title"/></h2>
<h3>(<xsl:value-of select="artist"/>/<xsl:value-of select="date"/>)</h3>
<table border="0" cellpadding="3" cellspacing="2">
<tr>
<th>#</th>
<th>Title</th>
<th class="ar">Time</th>
</tr>
<xsl:for-each select="track">
<tr>
<td> <xsl:number level="single" count="track" format="1."/> </td>
<td> <xsl:value-of select="."/> </td>
<td class="ar">
<xsl:call-template name="convert">
<xsl:with-param name="sec" select="number(@seconds)" />
</xsl:call-template>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template name="convert">
<xsl:param name="sec"/>
<xsl:value-of select="floor( $sec div 60 )"/>:<xsl:value-of
select="format-number( $sec mod 60, '00' )"/>
</xsl:template>
</xsl:transform>
The XSL transformation yields the XML-file parsed.xml, which you may view with your browser. However, if your browser is able to apply the XSL transformation itself, you can just point your browser to the original XML-File music.xml, and your browser will the XSL transformation. Isn't that cool?
Remarks:
The resulting XML-File (which is also HTML) itself relies on the CSS Stylesheet music.css.
The conversion from seconds to minutes:seconds is done by XSLT using XPath functions.