Start New Discussion within our Software Development Community

Hi,

I have an XML file that attaches an xsl stylesheet using version that has sorting function at the beginning of the file. At the same time, eason, I would like to put in some other information in the beginning, such as html headers as well.
Here is my code:

<xsl:template match="/">

<xsl:apply-templates select="music_songs/song">
<xsl:sort select="title"/>
<xsl:sort select="category"/>
<xsl:sort select="artist"/>
</xsl:apply-templates>

<html>
<head>
<title>My Page</title>
<link rel="stylesheet" href="css/cd_collection.css" type="text/css"/>
<!--[if IE]><link href="css/ie.css" rel="stylesheet" type="text/css"/><![endif]-->
</head>
<body>
<div id="main">
<h1>My Music List</h1>
<table class="songs">
<tr>
<th width="35%">Title</th>
<th width="25%">Album</th>
<th width="20%">Artist</th>
<th width="20%">Date</th>
</tr>
<xsl:apply-templates/>
</table>
</div>
</body>
</html>
</xsl:template>

The xsl is applied properly regarding sorting on xml elements, but none of the html documentation I tried to apply are displayed on the page when I opened it with my browser. Could anyone on the list please guide me on what problem I may have here?

Thanks for your help.

I got it figured out after fiddling around XSLT W3 Schools TryIt editor.

Got to do something like this:

<xsl:apply-templates select="music_songs/song">
                      <xsl:sort select="title"/>
                      <xsl:sort select="artist"/>
                       </xsl:apply-templates>    
                       <xsl:apply-templates/>

Then it would work.

This question has already been answered. Start a new discussion instead.