[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Sorting by an attribute
Subject: Re: Sorting by an attribute
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 09 Apr 2002 11:42:48 +0200
|
<xsl:template match="data">
<xsl:apply-templates select="row">
<xsl:sort select="@Cod"/>
</xsl:apply-templates>
</xsl:template>
Regards,
Joerg
Vrajitoru wrote:
I have a XML created by a ado.recordset. This XML looks like:
<?xml version='1.0' ?>
<?xml-stylesheet type='text/xsl' href='raport.xsl'?>
> <data>
<row Cod='212' Denumire='VINZARI CATRE ALTE UNITATI' Document='FACTURA'
Numar='12358' Data='2000-10-19' Furnizor='32802' Comanda='X'
Valoare='757900.0'/>
<row Cod='212' Denumire='VINZARI CATRE ALTE UNITATI' Document='FACTURA'
Numar='12710' Data='2000-10-24' Furnizor='4560' Comanda='X'
Valoare='76191050.0'/>
</data>
Is there a possibility to make a XSL that sorts this XML on a specific
attribute? ('Cod' for example)
Thanks
Vrajitoru
PS: This is a simple XSL that i made to test the sort function but it
doesn't work:
<?xml version='1.0'?><xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'><xsl:output method='html'/>
<xsl:template match='/'>
<html>
<head>
<title>Titlu</title>
</head>
<body>
<h1 align='center'>Titlul raportului</h1>
<table border='1' cellpadding='0' cellspacing='0' width='100%'>
<tr>
<th>Cod</th><th>Denumire</th><th>Document</th><th>Numar</th><th>Data</th><th
Furnizor</th><th>Comanda</th><th>Valoare</th>
</tr>
<xsl:apply-templates>
<xsl:sort select="row[@Cod]" order="ascending" data-type="number" />
</xsl:apply-templates>
</table>
</body>
</html>
</xsl:template>
<xsl:template match='row'>
<tr>
<td valign='Top' align='Left'><xsl:value-of select='@Cod'/></td>
<td valign='Top' align='Left'><xsl:value-of select='@Denumire'/></td>
<td valign='Top' align='Left'><xsl:value-of select='@Document'/></td>
<td valign='Top' align='Left'><xsl:value-of select='@Numar'/></td>
<td valign='Top' align='Left'><xsl:value-of select='@Data'/></td>
<td valign='Top' align='Left'><xsl:value-of select='@Furnizor'/></td>
<td valign='Top' align='Left'><xsl:value-of select='@Comanda'/></td>
<td valign='Top' align='Right'><xsl:value-of select='@Valoare'/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
--
System Development
VIRBUS AG
Fon +49(0)341-979-7419
Fax +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|