RE: [xsl] XLST Processors that support JavaScript

Subject: RE: [xsl] XLST Processors that support JavaScript
From: "Kirk Allen Evans" <kaevans@xxxxxxxxxxxxx>
Date: Tue, 3 Sep 2002 11:34:34 -0400
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Ziv Friedman
Sent: Tuesday, September 03, 2002 10:21 AM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE: [xsl] XLST Processors that support JavaScript

> So why is it that when I use "urn:schemas-microsoft-com:xslt" in the
> stylesheet tag I get the following error: "The scripting language
> 'vbscript' is not supported"?

That's not quite the same as JavaScript, now is it?  VBScript is not
supported in .NET, but VB, C#, JScript, and JavaScript are [1].  I
imagine that, if you installed J#, that it would be supported as well.
Here is a JavaScript example that works:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" 
	exclude-result-prefixes="tns msxsl">
	<msxsl:script language="JavaScript" implements-prefix="tns">

		function GetString()
	<xsl:template match="/">		
		<xsl:for-each select="root/child">
			<xsl:value-of select="tns:GetString()"/>

Change the language attribute of the msxsl:script element to "VB"
instead, and now this example works (note, though, that
VBScript-specific functions and syntax might not be supported in VB.NET

	<msxsl:script language="vb" implements-prefix="tns">
		function GetString()
			GetString = "foo"
		end function

The really cool part about .NET is that you can also use inline C# as
well as JavaScript or VB.NET.  Although, I would use an extension object
with the XsltArgumentList class instead, but this example shows that it
is possible:

	<msxsl:script language="C#" implements-prefix="tns">
		string GetString()


Kirk Allen Evans
Author, "XML And ASP.NET", New Riders Publishing

 XSL-List info and archive:

Current Thread