Subject: Re: New User- sort xml using xsl
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Thu, 31 Oct 2002 11:04:16 -0000
|
Hi Peter,
The problem is with your namespace declaration
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
This is outdated and <xsl:sort> wont work with this.
The XSLT namespace has the URI http://www.w3.org/1999/XSL/Transform.
eg.,
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
and it should work
HTH
vasu
----- Original Message -----
From: "SANTER Peter" <SanterP@xxxxxxxx>
To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, October 31, 2002 10:47 AM
Subject: New User- sort xml using xsl
> 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
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|
Vasu Chakkera - Thu, 31 Oct 2002 06:07:48 -0500 (EST) <=
|
|