This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Using DOM in XSL Documents (MSXML)
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Using DOM in XSL Documents (MSXML)
- From: "Hahn, Kimberly" <Kim dot Hahn at enform dot com>
- Date: Fri, 15 Jun 2001 11:31:18 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
I don't believe that you need the CData either, if you are using MSXML 3.
<msxsl:script language="VBScript" implements-prefix="vbs">
Function lineTotal(item)
Dim price
price = item.Item(0).selectSingleNode("tub").text
lineTotal = price
End Function
</msxsl:script>
The variable really isn't necessary, you can simply use:
<msxsl:script language="VBScript" implements-prefix="vbs">
Function lineTotal(item)
lineTotal = item.Item(0).selectSingleNode("tub").text
End Function
</msxsl:script>
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Chris Bayes
Sent: Thursday, June 14, 2001 6:07 AM
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] 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> </xsl:text>
> <xsl:value-of select="invoice/by/customer/name/first"/>
> <xsl:text> </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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list