[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

New User- sort xml using xsl

Subject: New User- sort xml using xsl
From: SANTER Peter <SanterP@xxxxxxxx>
Date: Thu, 31 Oct 2002 05:47:19 -0500
sort xml asp
Hello.  I have spent a bit of time trying to implement xsl:sort on an xml
file, without success.  I am trying to sort on the field_value of attribute
"seq" (i.e. 88 and 157).  Extracts of files follows.  Pls see blue,
commented code, in the xsl file for an idea of what I am trying to do. If
anyone could offer some guidance it would be appreciated.  Many thanks.
Rgds.  Peter.

XML:
<?xml version="1.0"?>
<conferences>
	<conf id="cnf1">
		<field id="area">
			<field_value>ENG-ECO</field_value>
		</field>
		<field id="dates">
			<field_value>12-18 May 2003</field_value>
		</field>
		<field id="venue">
			<field_value>SYD</field_value>
		</field>
		<field id="seq">
			<field_value>157</field_value>
		</field>
	</conf>
	<conf id="cnf2">
		<field id="area">
			<field_value>USA-FRA</field_value>
		</field>
		<field id="dates">
			<field_value>23/27 July 2003</field_value>
		</field>
		<field id="venue">
			<field_value>NYC</field_value>
		</field>
		<field id="seq">
			<field_value>88</field_value>
		</field>
	</conf>
 </conferences>

XSL:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
 <xsl:template match="/">
 <html>
 <HEAD>
  <title>Prototyping</title>
  <link rel="stylesheet" href="NavTree.css" type="text/css"/>
 </HEAD>
 <body>

 	<form name="conferencesToEdit" method="post"
action="EditConferences.asp">
 	<table  width="100%" bgcolor="#CCCCCC" align="center">
 	<tr>
		<td bgcolor="#FFFFFF" colspan="5" class="title">Conferences
		<div align="right" class="normal"><a
href="placeholder.htm"></a>
		<a href="placeholder.htm"></a><a
href="placeholder.htm"></a></div>
		</td>
	</tr>
	<tr>
		<td bgcolor="#FFFFFF" colspan="5" class="title">
		<div align="right" class="normal"><a
href="http://xyz/addconference.htm">add</a> | <a
href="placeholder.htm">remove</a> | <a
href="http://xyz/editconferences.asp">edit</a> </div>
		</td>
	</tr>
 	<tr class="normal-bold">
		<td></td>
		<td>area</td>		
		<td>dates</td>		
		<td>venue</td>		
		<td>seq</td>
	</tr>
	
 	<xsl:for-each select="conferences/conf">
	
	<!--
	<xsl:sort data-type="number" select="field[@id='seq']/field_value"
order="ascending" />	
	-->

	<tr>	
		<td class="normal" bgcolor="#FFFFFF">
		<a href="placeholder.htm">view</a>
		</td>			
			<xsl:for-each select="field">

		<td>
			<xsl:value-of select="field_value"/> 
		</td>			
			</xsl:for-each>

	</tr>
	
	</xsl:for-each>	
 	</table>	
 	</form>
 	</body>
 	</html>
 	</xsl:template>
</xsl:stylesheet>

ASP:
<%

Function loadXMLFile(strXMLFile, strXSLFile)

 Dim objXML
 Dim objXSL
 set objXML = Server.CreateObject("Microsoft.XMLDOM")

 objXML.async = false

 objXML.load(strXMLFile)

 set objXSL = Server.CreateObject("Microsoft.XMLDOM")

 objXSL.async = false

 objXSL.load(strXSLFile)

 Response.Write(objXML.transformNode(objXSL))

End Function

loadXMLFile server.MapPath("Conferences.xml"),
server.MapPath("allconferences.xsl")

%> 




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.