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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tns="urn:thisnamespace:tns" exclude-result-prefixes="tns msxsl"> <msxsl:script language="JavaScript" implements-prefix="tns"> function GetString() { return('foo'); } </msxsl:script> <xsl:template match="/"> <xsl:for-each select="root/child"> <xsl:value-of select="tns:GetString()"/> </xsl:for-each> </xsl:template> </xsl:stylesheet> 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 [1]): <msxsl:script language="vb" implements-prefix="tns"> function GetString() GetString = "foo" end function </msxsl:script> 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() { return("foo"); } </msxsl:script> [1] ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconvisualbasiclanguagechanges .htm Kirk Allen Evans http://www.xmlandasp.net Author, "XML And ASP.NET", New Riders Publishing http://www.amazon.com/exec/obidos/ASIN/073571200X XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XLST Processors that supp, Ziv Friedman | Thread | RE: [xsl] XLST Processors that supp, Eric Promislow |
[xsl] xslt on schema, OComes | Date | [xsl] Please help with Grouping & s, Khan, Amir |
Month |