This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Sorting by an attribute


<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@virbus.de
www.virbus.de


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]