Passing values from an XSL file to a function
Hi,
I am writing a function to add values into a Database, using VB/ASP/XML. In the XSL file, I get the values from the user and pass them as arguments to a VBscript function so that the new nodes can be created, populated and appended. However, on the onchange event, the AppendNodes function does not seem to be getting invoked. Could anyone help, please?
Part of my XSL file :
<input>
<xsl:attribute name="onChange">AppendNodes 'me.Value,'Value1',AttrDisp'</xsl:attribute>
<xsl:attribute name="Value">Nil</xsl:attribute>
<xsl:attribute name="size">25</xsl:attribute>
<xsl:attribute name="maxlength">20</xsl:attribute>
</input></TD></TD></TR>
(AttrDisp is the name of the XML data island)
___________________
The function:
Function AppendNodes(nodeval,eleval,XMLDataIsl)
msgbox "here"
Set doc= XMLDataIsl.XMLDocument
Set qtytext = doc.createTextnode("nodeval")
Set qtyelement = doc.createElement("eleval")
qtyelement.appendChild qtytext
Set orderitemNode = doc.selectsinglenode("//mand")
orderitemnode.appendChild qtyelement
End Function
[1304 byte] By [
erin] at [2007-11-18 18:51:22]

# 2 Re: Passing values from an XSL file to a function
Hi,
No, it isn't working with static HTML either. Could you help me check if there is a problem with the AppendNodes Function?
::Appendnodes function::
Function AppendNodes(nodeval,eleval,XMLDataIsl)
msgbox "here"
Set doc= XMLDataIsl.XMLDocument
Set qtytext = doc.createTextnode("nodeval")
Set qtyelement = doc.createElement("eleval")
qtyelement.appendChild qtytext
Set orderitemNode = doc.selectsinglenode("//mand")
orderitemnode.appendChild qtyelement
End Function
This was ths static HTML function call
Appendnodes("2","Value1",AttrDisp)
Appendnodes("2","status",AttrDisp)
Appendnodes("2","notes",AttrDisp)
Thanks a lot!
erin at 2007-11-10 3:29:15 >

# 4 Re: Passing values from an XSL file to a function
Hi,
Fixed the previous problem. It was a syntax error in the fn call. So now I'm able to pass the values and enter into the function. But it doesn't seem to be working properly. The line:
Set qtyelement = doc.createElement(eleval)
doesnt seem to be transferring the value of eleval to qtyelement. Subsequently, the append function is not workign either. Any ideas? I've appended the code here:
Function AppendNodes(nodeval,eleval,XMLDataIsl)
set doc=CreateObject("Microsoft.XMLDOM")
doc.async="false"
doc.load(XMLDataIsl)
Set qtyelement = doc.createElement(eleval)
Set qtytext = doc.createTextnode(nodeval)
msgbox qtytext.nodevalue
qtyelement.appendChild qtytext
Set orderitemNode = doc.selectsinglenode("//mand")
orderitemnode.appendChild qtyelement
End Function
nodeval is the value to be inserted into the newly created node, eleval is the new element to be inserted into the island. XMLDataIsl is, of course, the xml file.
Thanks a lot!
erin at 2007-11-10 3:31:18 >
