|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Input.xml
Code:
<employees> <employee id="1" name="Tom" salary="5000"></employee> <employee id="2" name="Michelle" salary="4800"></employee> <employee id="3" name="Samuel" salary="7000"></employee> </employees> My desired output (output.xml) Code:
<staffs> 1. Samuel 7000 2. Tom 5000 3. Michelle 4800 </staffs> How to write my XSL so that it transforms as I want? Note that the output is <auto number increase><name><salary> all located in one element node. The output requirement/format is fixed ! ![]() |
|
#2
|
|||
|
|||
|
|
|
#3
|
|||
|
|||
|
use this:
<xsl:for-each select="employees/employee"> <xsl:sort select="@salary" data-type="number" order="descending"/> <xsl:value-of select="position()"/>.<xsl:value-of select="@name"/>*<xsl:value-of select="@salary"/> </xsl:for-each> -- Murugesan M ******************************************* Quote:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > [Help] XML transform with sorting |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|