Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing an XML Node value into VBScript..

Status
Not open for further replies.

gyfu

Programmer
May 28, 2001
77
HK
Guys, I have been surfing around for this question and did not seem to be able to find it..

This is my script in my xsl..
Code:
<msxsl:script language="VBScript" implements-prefix="user">
<![CDATA[
	Function theDate(NODE)
		thedate = NODE & "January"							
	End Function
	]]>
</msxsl:script>
And here is my html code in XSL..
Code:
<xsl:value-of disable-output-escaping="yes" select="user:theDate(???)"/>
I would like to pass a node to the function, where '???' is. How can I accomplish this?

Thanks.

-- gyfu --
Crystal Ver 10
Microsoft SQL
 
>I would like to pass a node to the function, where '???' is. How can I accomplish this?

But your extension function should accept only string. Hence, it is a type mismatch if you pass a node or nodelist to it.

It depends on your xml and matches. For instance if the context is matched by a node, this example would show you how it functions.
[tt]
<xsl:variable name="y" select="position()" />
<xsl:value-of disable-output-escaping="yes" select="user:theDate($y)"/>
[/tt]
But, this uses the position() info. Other info, as long as it is resulting in string type would pass the same. The main thing you need clear up in your mind is that NODE is self-misleading. You should not pass a node to the function unless the function itself has to be rewritten according.

 
Tsuji,
I guess you are right. My apologies, I guess I need to make it clearer. Forgive me as I am a newbie at this and I read in some tutorial that I need to pass in the node. Basically in my XML file, I have a node called 'Number'.

I want to pass in the value of the 'Number' into the function. How would I do that?

Thanks.

-- gyfu --
Crystal Ver 10
Microsoft SQL
 
Since you're nowhere use the number for arithmetic manipulation, it is simply something like this.
[tt]
<xsl:variable name="z" select="string()" />
<xsl:value-of disable-output-escaping="yes" select="user:theDate($z)"/>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top