sorting - How sort XML using XSLT ascending order -


i have write xslt view bus stop information want ask how can make order in ascending stop number. can give me hand in how sorted

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform">   <xsl:template match="/">     <xsl:element name="html">       <xsl:element name="body">         <table style="width:720px" border="3">           <tr>             <td>stop #</td>             <td>route #</td>             <td>name</td>             <td>latitude</td>             <td>longitude</td>           </tr>           <xsl:apply-templates select="//stop" />         </table>       </xsl:element>     </xsl:element>   </xsl:template>   <xsl:template match="stop">     <tr>       <td>         <xsl:value-of select="@number" />       </td>       <td>         <xsl:value-of select="routes" />       </td>       <td>         <xsl:value-of select="@name" />       </td>       <td>         <xsl:value-of select="location/latitude" />       </td>       <td>         <xsl:value-of select="location/longitude" />       </td>     </tr>   </xsl:template> </xsl:stylesheet> 

you can use sort in apply-templates this:

<xsl:apply-templates select="//stop">     <xsl:sort order="ascending" select="@number" data-type="number"/> </xsl:apply-templates> 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -