472,145 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

XSL sorting version number strings

2
I am not that familiar with XML or XSL and I am trying to sort application version number strings in an XML file that my team uses for application installations on our Linux servers. I have tried the xsl:data-type=number, but that doesn't work. The output of the XML file is exactly what the XML file has and I would like to sort it by the number value.

Below is the some of the output from the XML file.
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/xsl" href="releases.xsl"?>
  3. <applications>
  4.   <application>
  5.     <name>AAT</name>
  6.     <versions>
  7.       <version>4.0.1.10</version>
  8.       <version>4.0.1.13</version>
  9.       <version>4.0.1.14</version>
  10.       <version>4.0.1.15</version>
  11.       <version>4.0.1.16</version>
  12.       <version>4.0.1.8</version>
  13.       <version>4.0.1.9</version>
  14.       <version>4.0.3.1</version>
  15.       <version>4.0.3.10</version>
  16.       <version>4.0.3.11</version>
  17.       <version>4.0.3.12</version>
  18.       <version>4.0.3.13</version>
  19.       <version>4.0.3.14</version>
  20.       <version>4.0.3.15</version>
  21.       <version>4.0.3.16</version>
  22.       <version>4.0.3.17</version>
  23.       <version>4.0.3.2</version>
  24.       <version>4.0.3.3</version>
  25.       <version>4.0.3.4</version>
  26.       <version>4.0.3.5</version>
  27.       <version>4.0.3.6</version>
  28.       <version>4.0.3.7</version>
  29.       <version>4.0.3.8</version>
  30.       <version>4.0.3.9</version>
  31.     </versions>
  32. </applications>
  33.  
Here is the XSL file.

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0"
  3.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4. <xsl:output method="html"/>
  5.  
  6.   <xsl:template match="/applications">
  7.     <head>
  8.       <title>Available Application Releases</title>
  9.       <link rel="stylesheet" href="http://hsosm1/ctrl/inc/main.css" type="text/css" />
  10.     </head>
  11.     <body>
  12.       <table align="center" border="1">
  13.           <tr>
  14.             <td><b>Application</b></td>
  15.             <td><b>Release</b></td>
  16.           </tr>
  17.         <xsl:for-each select="application">
  18.           <tr>
  19.            <td valign="top"><xsl:value-of select="name" /></td>
  20.              <td>
  21.                <table border="0">
  22.                  <xsl:for-each select="versions/version">
  23.                    <tr><td><xsl:value-of select="." /></td></tr>
  24.                  </xsl:for-each>
  25.                </table>
  26.              </td>
  27.           </tr>
  28.         </xsl:for-each>
  29.       </table>
  30.     </body>
  31.   </xsl:template>
  32. </xsl:stylesheet>
  33.  
TIA,

Elliot
Oct 17 '06 #1
0 1815

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Xah Lee | last post: by
9 posts views Thread by p0wer | last post: by
7 posts views Thread by Federico G. Babelis | last post: by
22 posts views Thread by mike | last post: by
8 posts views Thread by nidhog | last post: by
20 posts views Thread by Xah Lee | last post: by
3 posts views Thread by SilverWolf | last post: by
19 posts views Thread by Owen T. Soroke | last post: by
16 posts views Thread by Kittyhawk | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.