Subject: [xsl] Loading XML with XSL for sorting in ASP From: Bjorn Van Blanckenberg <bjornvb@xxxxxx> Date: Tue, 24 Jan 2006 12:32:55 +0100 |
'Load the XML file. set objXMLbron = Server.CreateObject("Microsoft.XMLDOM") objXMLbron.async = false objXMLbron.load(xmlFile) 'Load the XSL file. set objXSL = Server.CreateObject("Microsoft.XMLDOM") objXSL.async = false objXSL.load(server.MapPath("sorttit3.xsl"))
set objXML = Server.CreateObject("Microsoft.XMLDOM") 'load transformed unsorted XMl and sort it objXML.loadXML(objXMLbron.transformNode(objXSL))
set objXML = objXMLbron.transformNode(objXSL) Set objRoot = objXML.documentElement
<?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <settings> <user> <owner>User1</owner> <other> <name>User2</name> <total>3</total> <nodig>-5</nodig> </other> <other> <name>User3</name> <total>14</total> <nodig>6</nodig> </other> </user> <user> <owner>User2</owner> <other> <name>User1</name> <total>8</total> <nodig>5</nodig> </other> <other> <name>User3</name> <total>7</total> <nodig>-2</nodig> </other> </user> <user> <owner>User3</owner> <other> <name>User1</name> <total>33</total> <nodig>-6</nodig> </other> <other> <name>User2</name> <total>9</total> <nodig>2</nodig> </other> </user> </settings> <DVD> <title>The title</title> <year>The Year</year> <owner>User3</owner> <counter>1</counter> <other> <name>User3</name> <status>ok</status> <finalstatus>ok</finalstatus> </other> <other> <name>User2</name> <status>see</status> <finalstatus>waiting</finalstatus> </other> <other> <name>User1</name> <status>ok</status> <finalstatus>ok</finalstatus> </other> </DVD> </catalog>
<xsl:template match="/catalog"> <xsl:apply-templates> <xsl:sort select="title" /> </xsl:apply-templates> </xsl:template>
<xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"> <xsl:sort select="title" /> </xsl:apply-templates> </xsl:copy> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Consolidating stylesheet , omprakash . v | Thread | RE: [xsl] Loading XML with XSL for , cknell |
RE: [xsl] simple xslt question, ret, Michael Kay | Date | [xsl] Natural Sort, Rudi Starcevic |
Month |