Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML SelectSingleNode problem

Status
Not open for further replies.

liberty4all

Programmer
Aug 27, 2002
11
0
0
IL
Hi, I am trying to sort an XML table dynamically, according to the header the user clicked on. In order to do that I need to select the sort node from the XSL file being used by the table, change its attributes and reload it.
For some reason this line returns null for me
Code:
set sortNode= docstyle.SelectSingleNode("//*[local-name()='sort']")

this is my xsl file
Code:
<?xsl version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] version="1.0">
<xsl:template match="/">
	<html>
		<table border="1">
			<tr><th id="player" onClick="HeaderClick('PlayerName')">Player</th>
			      <th id="ppg" onClick="HeaderClick('ppg')">PPG</th>
			        <th id="total" onClick="HeaderClick('total')">Total</th>
			        <th id="gms" onClick="HeaderClick('gms')">Games</th>
			</tr>
<xsl:apply-templates select="//row">
	<xsl:sort select="@pts" data-type="number" order ="descending"/>
</xsl:apply-templates>
		</table>
	</html>
</xsl:template>
<xsl:template match="row">
	<tr>
	<td><xsl:value-of select="@playername"/></td>
	<td><xsl:value-of select="@ppg"/></td>
	<td><xsl:value-of select="@pts"/></td>
	<td><xsl:value-of select="@gms"/></td>
	</tr>
</xsl:template>
</xsl:stylesheet>

any help would be greatly appreciated
 
Maybe I should explain how I get docStyle from which I select the node from.. so this is how:
Code:
dim docStyle 
set docStyle = CreateObject("MSXML2.DOMDocument.4.0")
docStyle.async=false
docStyle.load "ntscorers.xsl"
ntscorers.xsl is the xsl that appears in my original post.
sorry if I wasn't clear
 
Make sure that : [1] The real script is using v4.0 (or higher for that matter) as shown; [2] The xsl file is in the same directory as the script; [3] The xsl document is well-formed. Else, the script is fine.
 
thanks for your replay. could you explain what you mean by "the real script"? the xsl is indeed well-formed and in the same directory as the script that loads it
 
If you can assure [2] and [3], then you have to make sure version 4.0 of the msxml2 core service is installed. Otherwise, the error is not coming from those few lines you've shown the forum.
 
Where is the version 4.0 of the msxml2 core service supposed to be installed? on the server that my website is running on?
My page works, it shows the table using the xsl as it should. I have a function that is called when the header of the table is clicked, that is where I try to select the sort node from the stylesheet and message box it. I get an error on page, and when I double click the bottom left corner to see what the error is it says object variable not set - as in the sortNode object I try to show in the message box is null. That's how I understand it anyway...
 
>Where is the version 4.0 of the msxml2 core service supposed to be installed?
On the m/c where the script is called and run. The rest I have no comment as what is essential I have told.
 
Thank you for your patience.. I thought that msxml2 version 4.0 is standart on any computer that runs IE, isn't it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top