|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








