This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Using DOM in XSL Documents (MSXML)


Ruairi,
What you get passed is a XMLDOMNodeList so you need to do a nextNode on it
to get a node that you can work with
var aNode = item.nextNode();

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


>-----Original Message-----
>From: owner-xsl-list@lists.mulberrytech.com
>[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Ruairi
>Sent: 14 June 2001 11:56
>To: xsl-list@lists.mulberrytech.com
>Subject: [xsl] Using DOM in XSL Documents (MSXML)
>
>
>Hi,
>
>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"
>
>Thanks....
>
>
>Regards,
>-Ruairi
>
><?xml version="1.0"?>
><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>version="1.0"
>		xmlns:msxsl="urn:schemas-microsoft-com:xslt"
>                xmlns:vbs="http://www.abc.com/";>
>
>
> <msxsl:script language="VBScript" implements-prefix="vbs">
> <![CDATA[
>      running_total=0
>
>      function lineTotal(item)
>
>        var price = item.selectSingleNode("tub").text
>        return price
>      End Function
>    ]]>
></msxsl:script>
>
><xsl:output method="html"/>
>
>	   <xsl:template match="/">
>		<body>
>		<h2 align="center" style="color:red">Scoops on Scooters</h2>
>		<h3>Customer:
>		<xsl:text>&#x20;</xsl:text>
>		<xsl:value-of select="invoice/by/customer/name/first"/>
>		<xsl:text>&#x20;</xsl:text>
>		<xsl:value-of select="invoice/by/customer/name/second"/>
>		</h3>
>
>		<h3 align="right">Date: <xsl:value-of
>select="invoice/@date"/></h3>
>
>		<xsl:apply-templates select="//order"/>
>		</body>
>	   </xsl:template>
>
>
><xsl:template match="order">
>	<h3>The Order Summary:</h3>
>	<table border="1" cellspacing="0"><tr>
>	<th>Product</th>
>	<th>Unit Price</th>
>	<th>Quantity</th>
>	<th>Total</th></tr>
>	<xsl:apply-templates select="product"/>
>
>	</table>
>
>	<h3>Thank You, Phone and Scoop Again!! (800)-555-0000</h3>
></xsl:template>
>
><xsl:template match="product">
>	<tr>
>	<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>
>	</tr>
></xsl:template>
>
></xsl:stylesheet>
>
>
>
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]