Subject: xsl:sort From: April Fleming <AFleming@xxxxxxxxxxxx> Date: Mon, 21 Jun 2004 14:50:18 -0400 |
I am using xsl:sort to sort through rows of xml data, the code is dynamic so that a user can specify what attribute to "order by". The problem is the way that the xml data is formatted, optional attributes do not always exist, so when i try to use one of these values in the <xsl:sort> it does not work when all rows do not have that attribute. So the code works great if each "row" has the given attribute, but does not if the row does not have the attribute (like "device_os" below) Any ideas? xml data <z:row ip="111.111.1.11" Device_Name="SUPERIOR-JKMXGQ" Device_MakeModel="" Device_Sweep_Date="2004-05-03T15:40:56" Device_Response_Time="0 ms" DeepScanned="0" Device_Master_GUID="86799AADE76C4A35AFA6A6DC8AADEDBE" Device_ScanAttempt_Count="0" /> <z:row ip="222.222.2.22" Device_Name="STEVE-ZQAW4ILXU" Device_OS="Windows XP" Device_Role="WorkStation Network Role" Device_MakeModel="" Device_Sweep_Date="2004-05-03T15:40:56" Device_Response_Time="0 ms" DeepScanned="0" Device_Master_GUID="87BA148E6C7D4723A9BA7DA4447175CE" Device_ScanAttempt_Count="0" /> <z:row ip="333.333.3.33" Device_Name="DROID" Device_OS="Windows XP" Device_Description="Hardware:x86 Family 15 Model 2 Stepping 9 AT/AT COMPATIBLE - Software: Microsoft Windows XP Version 5.1(Build 2600 Uniprocessor Free)" Device_Role="WorkStation Network Role Running SQL Server" Device_MakeModel="" Device_Sweep_Date="2004-05-03T15:40:56" Device_Response_Time="0 ms" Device_SNMP_Contact="Systems Inc" DeepScanned="0" Device_Master_GUID="D471BE52A69148AB9ADC464073BF683A" Device_ScanAttempt_Count="0" /> xxslt code <xsl:template match="rs:data"> <xsl:comment>Loop over the rows in the recordset</xsl:comment> <xsl:for-each select="z:row"> <xsl:sort select="z:row/@*[name()=$orderBy]"/> April
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
using a portion of the input filena, Reece, Michael Clark | Thread | Re: [xsl] xsl:sort, G. Ken Holman |
Re: [xsl] XSL-FO : table-cell width, Paul Tremblay | Date | Re: [xsl] XSL-FO : table-cell width, J.Pietschmann |
Month |