This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Using DOM in XSL Documents (MSXML)
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Using DOM in XSL Documents (MSXML)
- From: "Ruairi" <ruairi at rutlands dot com>
- Date: Thu, 14 Jun 2001 12:55:33 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
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