[xsl] Loading XML with XSL for sorting in ASP

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
My problem is that I want to sort all the DVD nodes of my XML and use asp to convert it to html.
the XSL just has to sort all the DVD and the settingsnode may not be altered.


If it's possible I want to sort every othernode by name in evry DVDnode.

Can somebody help me with the XSL because now it seems that I dont get any output

Below I've posted a piece of the ASP code and XML and full XSL

Thanks Bjorn



my ASP

'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

my XML

<?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>

my XSL

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>


<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>

</xsl:stylesheet>

Current Thread