at first make a xml filedata
eg musik.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="musik.xsl"?>
<musik>
<item typ="Vinyl"><!--here data of musik -->
<year>1981</year>
<kind>movisound</kind>
</item>
<item typ="Vinyl"><!--here data of musik -->
<year>1982</year>
<kind>movisound</kind>
</item>
<item typ="Vinyl"><!--here data of musik -->
<year>1983</year>
<kind>movisound</kind>
</item>
<item typ="mp3"><!--here data of musik -->
<year>2001</year>
<kind>movisound</kind>
</item>
<item typ="mp3"><!--here data of musik -->
<year>2002</year>
<kind>movisound</kind>
</item>
<item typ="CD"><!--here data of musik -->
<year>1991</year>
<kind>movisound</kind>
</item>
<item typ="CD"><!--here data of musik -->
<year>1992</year>
<kind>movisound</kind>
</item>
<item typ="CD"><!--here data of musik -->
<year>1995</year>
<kind>movisound</kind>
</item>
<item typ="mp3"><!--here data of musik -->
<year>2007</year>
<kind>movisound</kind>
</item>
</musik>
in same dir make a xsl file
call musik.xsl
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<xsl:apply-templates select="musik"></xsl:apply-templates>
</html>
</xsl:template>
<xsl:template match="musik">
<h1>mp3</h1>
<xsl:apply-templates select="item[@typ='mp3']">
<!-- here can sort -->
</xsl:apply-templates>
<h1>Vinyl</h1>
<xsl:apply-templates select="item[@typ='Vinyl']">
<!-- here can sort -->
</xsl:apply-templates>
<h1>CD</h1>
<xsl:apply-templates select="item[@typ='CD']">
<xsl:sort data-type="number" select="year" order="descending"></xsl:sort>
<!-- here can sort -->
</xsl:apply-templates>
</xsl:template>
<xsl:template match="item">
<!-- here more out from the musik.xml -->
<p>
<xsl:value-of select="year"/>
</p>
</xsl:template>
</xsl:stylesheet>
in the browser click musik.xml
result
HTML Code:
<html>
<h1>mp3</h1>
<p>2001</p>
<p>2002</p>
<p>2007</p>
<h1>Vinyl</h1>
<p>1981</p>
<p>1982</p>
<p>1983</p>
<h1>CD</h1>
<p>1995</p>
<p>1992</p>
<p>1991</p>
</html>
Helmut Hagemann