using ancestorChildNumber in VBScript

Subject: using ancestorChildNumber in VBScript
From: "Newman, Todd" <ToddNewman@xxxxxxxxxxxxxxxx>
Date: Mon, 20 Nov 2000 14:32:49 -0500
Hi all,

Count me completely baffled.  I did some work with XML/XSL using the IE5
version of MSXML.  Now, I'm trying to convert my pages to MSXML 3.0 and I'm
going a bit nuts.  Here's where I came from...

Partial XML Source
	<SecurityDescription>ALLSTATE CORP</SecurityDescription>

and here's part of the *old* XSL Source
<xsl:template match="Symbol">
<xsl:value-of select="."/></a>

<xsl:script xmlns:xsl="";
  function SymbolHref(e)
	SymbolHref = "DetailScreen.asp?idx=" &
ancestorChildNumber("Holding",e) - 1
  end function

As I said, that worked fine.  ancestorChildNumber would back up the tree
until it got to "Holding" and return the index of that node relative to its
parent.  I subtracted 1 because I wanted the index to be zero-based.  Trying
to do things the new way, I can't get the SymbolHref function to work.

Here's part of the *new* XSL Source
<msxsl:script language="VBScript" implements-prefix="user"><![CDATA[
	function SymbolHref(nodelist)
	Dim nodeRef
		set nodeRef = nodelist.nextNode()
		SymbolHref = "DetailScreen.asp?idx=" &
ancestorChildNumber("Holding", nodeRef) - 1
		set nodeRef = Nothing
	end function

<xsl:template match="Symbol">
  <td><a><xsl:attribute name="href"><xsl:value-of
  <xsl:value-of select="."/></a></td>

First of all, I really do need to convert to the "new" way so that I can use
xsl:param and xsl:include.  The error I get is a 'Type mismatch' on the 2nd
parameter of ancestorChildNumber.  Here are some things I've tried and their

	SymbolHref = "DetailScreen.asp?idx=" &
ancestorChildNumber("Holding", nodelist.nextNode()) - 1
Result: Same 'Type mismatch' error.

	SymbolHref = "Hi there"
Result: No error, returns the string

	SymbolHref = nodelist.nextNode().nodeTypedValue
Result: No error, returns the value I would expect

	set nodeRef = nodelist.nextNode()
	SymbolHref = nodeRef.nodeTypedValue
Result: No error, same as previous

So, it looks like nodelist.nextNode() does return a reference to the current
node since I can get to its .nodeTypedValue property. (or its .xml property
etc.)  But when I try to pass this reference to ancestorChildNumber, I get
the error as mentioned above.

Can anyone help me find what to pass in?


 XSL-List info and archive:

Current Thread