473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 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 1891

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

Similar topics

2
by: Xah Lee | last post by:
Today we'll write a program that can sort a matrix in all possible ways. Here's the Perl documentation. I'll post a Perl and Python version in 2 days. ----------- sort_matrix( $matrix, , ,...
9
by: p0wer | last post by:
Let's suppose I have this sample document: <root> <entry id="1" <date>2003-08-03</date> <param_1>5</param_1> <param_2>10</param_2> </entry> <entry id="2"> ...
7
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
22
by: mike | last post by:
If I had a date in the format "01-Jan-05" it does not sort properly with my sort routine: function compareDate(a,b) { var date_a = new Date(a); var date_b = new Date(b); if (date_a < date_b)...
8
by: nidhog | last post by:
Hello guys, I made a script that extracts strings from a binary file. It works. My next problem is sorting those strings. Output is like: ---- snip ---- 200501221530
20
by: Xah Lee | last post by:
Sort a List Xah Lee, 200510 In this page, we show how to sort a list in Python & Perl and also discuss some math of sort. To sort a list in Python, use the “sort” method. For example: ...
3
by: SilverWolf | last post by:
I need some help with sorting and shuffling array of strings. I can't seem to get qsort working, and I don't even know how to start to shuffle the array. Here is what I have for now: #include...
19
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to...
16
by: Kittyhawk | last post by:
I would like to sort an Arraylist of objects on multiple properties. For instance, I have a Sort Index property and an ID property (both integers). So, the results of my sort would look like this:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.