[XSL] sort element

sort element [XSL] - XML/XSL - Programmation

Marsh Posté le 30-03-2005 à 08:41:01    

voici mon probleme
 
I have to "sort" an XML using the following XSL. This XSL gets rid of the node characteristic of type SETTINGSET.
 
 
I was thinking to use xsl:sort. I found examples using values but none using nodes as criteria.
 
I have to move up the parm element just before the node characteristic.  
 
 
current XSL
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl  utput method="xml" indent="yes"/>
 
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()[not(@type='SETTINGSET')]"/>
</xsl:copy>
</xsl:template>
 
</xsl:stylesheet>
 
 
 
actual XML  
 
<characteristic type="PXLOGICAL">
<characteristic type="PORT">
<parm name="PORTNBR" value="8080"/>
</characteristic>
<characteristic type="PXPHYSICAL">
<parm name="PXADDR" value="131.111.3.4"/>
<parm name="PXADDRTYPE" value="IPV4"/>
<parm name="TO-NAPID" value="Browsing_GPRS"/>
</characteristic>
 
 
<parm name="PROXY-ID" value="PROXY1"/>
<parm name="NAME" value="Proxy 1"/>
 
 
</characteristic>
 
 
 
Expected XML:
 
<characteristic type="PXLOGICAL">
 
<parm name="PROXY-ID" value="PROXY1"/>
<parm name="NAME" value="Proxy 1"/>
 
<characteristic type="PORT">
<parm name="PORTNBR" value="8080"/>
</characteristic>
 
<characteristic type="PXPHYSICAL">
<parm name="PXADDR" value="131.111.3.4"/>
<parm name="PXADDRTYPE" value="IPV4"/>
<parm name="TO-NAPID" value="Browsing_GPRS"/>
</characteristic>
 
</characteristic>

Reply

Marsh Posté le 30-03-2005 à 08:41:01   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed