How do I sort by [rank] and display [name] with [xsl]?

V

volunteer

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="filename.xsl"?>
<markers date="20060523">
04:21:50 PM
<marker sn="1" rank="6" name="john" />
<marker sn="2" rank="5" name="mary" />
<marker sn="3" rank="4" name=suzy" />
</markers>

How do I sort by [rank] and display [name] using [xsl] etc- some help
with drill-down?
Thanks, Lorrie

[reference]:
http://groups.google.com/group/comp...IeT1EDOM2mW4U1ahHovJa5cimornVOgAGdfrh31zskQ7Q
http://groups.google.com/group/comp...5e45baaff2c14d?q=sort&rnum=1#0a5e45baaff2c14d
 
J

Joris Gillis

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="filename.xsl"?>
<markers date="20060523">
04:21:50 PM
<marker sn="1" rank="6" name="john" />
<marker sn="2" rank="5" name="mary" />
<marker sn="3" rank="4" name=suzy" />
</markers>

How do I sort by [rank] and display [name] using [xsl] etc- some help
with drill-down?


I guess the best way to learn is to learn by example:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="xml" indent="yes"/>

<xsl:template match="markers">
<table>
<caption>markers</caption>
<tr>
<th>name</th>
<th>rank</th>
</tr>
<xsl:apply-templates select="marker">
<xsl:sort select="@rank" data-type="number" order="ascending"/>
</xsl:apply-templates>
</table>
</xsl:template>

<xsl:template match="marker">
<tr>
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="@rank"/></td>
</tr>
</xsl:template>

</xsl:stylesheet>

regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top