[xsl] Using DOM in XSL Documents (MSXML)

Subject: [xsl] Using DOM in XSL Documents (MSXML)
From: "Ruairi" <ruairi@xxxxxxxxxxxx>
Date: Thu, 14 Jun 2001 12:55:33 +0200

I am using microsoft MSXML3.0 to illustrate to VB programmers what they can
do with XSL.  I want to show them a comparison of XSL recursive templates
with XSL extensions.  I want to show them how to do VB or JScript stuff in a
xsl:script type element.  I know this is normally not the done thing but
they need to know it, just in case...

However I have a small problem.  I am trying to pass the content node into
the VBS function and it is not getting there.  I am getting the following
error: "Object doesn't support the object or method item.selectSingleNode"



<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

 <msxsl:script language="VBScript" implements-prefix="vbs">

      function lineTotal(item)

        var price = item.selectSingleNode("tub").text
        return price
      End Function

<xsl:output method="html"/>

	   <xsl:template match="/">
		<h2 align="center" style="color:red">Scoops on Scooters</h2>
		<xsl:value-of select="invoice/by/customer/name/first"/>
		<xsl:value-of select="invoice/by/customer/name/second"/>

		<h3 align="right">Date: <xsl:value-of select="invoice/@date"/></h3>

		<xsl:apply-templates select="//order"/>

<xsl:template match="order">
	<h3>The Order Summary:</h3>
	<table border="1" cellspacing="0"><tr>
	<th>Unit Price</th>
	<xsl:apply-templates select="product"/>


	<h3>Thank You, Phone and Scoop Again!! (800)-555-0000</h3>

<xsl:template match="product">
	<td width="200"><xsl:value-of select="@name"/></td>
	<td align="center">
	<xsl:value-of select="price/@RRP"/></td>
	<td align="center">
	<xsl:value-of select="sum(quantity//text())"/></td>
	<td align="right" width="80">
	<xsl:value-of select="vbs:lineTotal(.)"/></td>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread