[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XLST Processors that support JavaScript

Subject: RE: XLST Processors that support JavaScript
From: Eric Promislow <ericp@xxxxxxxxxxxxxxx>
Date: Wed, 4 Sep 2002 10:25:12 -0700
xsltargumentlist javascript
Kirk, the other issue here is how to access the MS XPath
extensions derfined in MSXML 4.0 (defined in the URI
mk:@MSITStore:C:\Program%20Files\MSXML%204.0\doc\xmlsdk.chm::/htm/xpath_functions_6igj.htm
 -- this is the MSXML 4.0 SDK Docs -- Core Services/XPath Reference/
XPath Functions/MS XPath Extension Functions).  The function I
see come up repeatedly is 'ms:format-date', and it's significantly
easier to use than System.DateTime.

I can't figure out how to access this namespace without writing a
.net wrapper class around MSXML 4.   Is there a way of doing this
inside System.Xml.Xsl XSLT?

- Eric

> Date: Tue, 3 Sep 2002 11:34:34 -0400
> From: "Kirk Allen Evans" <kaevans@xxxxxxxxxxxxx>
> Subject: RE:  XLST Processors that support JavaScript
> 
> - -----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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.