Subject: Re: Microsoft's .Net XML 'System.Xml.Xsl.XslTransform' and Scripting
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 14 Jan 2003 11:14:24 -0800 (PST)
|
VBScript is no-longer supported in .Net.
>From the VS.Net documentation:
help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconxsltstylesheetscriptingusingmsxslscript.htm
"The <msxsl:script> element is defined below:
<msxsl:script language = "language-name" implements-prefix = "prefix of
user namespace"> </msxsl:script>
where msxsl is a prefix bound to the namespace
urn:schemas-microsoft-com:xslt.
The language attribute is not mandatory, but if specified, its value
must be one of the following: C#, VB, JScript, JavaScript, VisualBasic,
or CSharp. If not specified, the language defaults to JScript. The
language-name is not case-sensitive so 'JavaScript' and 'javascript'
are equivalent."
Hope this helped.
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
"John Aschenbrenner" <jaschenbrenner@xxxxxxxxxxxxxxx> wrote in message
news:DBC251EC34B0D411B403000476AAA48279F912@xxxxxxxxxx
> Has anyone been able to get the above .Net assembly to work with XSL
that
> contains script. In the past I have been able to embed VB & Java
Script in
> a CDATA section in the XSL file and have it work fine using MSXML.
Does
> anyone know if this still works and if so how? I have not been able
to get
> it to work with the following example.
>
> <!-- Source file -->
> <?xml version="1.0" encoding="UTF-8"?>
> <root>
> <row theDate="2003-01-14"/>
> </root>
>
> <!-- Transform file -->
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet
> xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
> xmlns:msxsl='urn:schemas-microsoft-com:xslt'
> xmlns:var='urn:var'
> xmlns:user='urn:user'
> exclude-result-prefixes='msxsl var user'
> version='1.0'>
> <xsl:output method="html" encoding="utf-8"/>
> <xsl:template match="root">
> <html>
> <head>
> <title></title>
> </head>
> <body>
> <xsl:variable name="myDate" select="row/@theDate"/>
> The date is
> <xsl:value-of select="$myDate"/><br/>
>
> <xsl:variable name='var:addDate' select='user:mydateadd("d",
"15",
> string($myDate))'/>
> Add 15 days to that date =
> <xsl:value-of select="$var:addDate"/><br/>
> </body>
> </html>
> </xsl:template>
>
> <!-- VB Script function to add to the date -->
> <msxsl:script language='VBScript' implements-prefix='user'>
> <![CDATA[
> Function MyDateAdd(Interval, Number, TheDate)
>
> Dim sumDate
> Dim myDate(2)
>
> sumDate = DateAdd(CStr(Interval), CDbl(Number),
> CDate(TheDate))
>
> ' necessary to do some string manipulation because the
> DateAdd func returns wrong format
> myDate(0) = DatePart("yyyy", CDate(sumDate))
> myDate(1) = DatePart("m", CDate(sumDate))
> If Len(myDate(1)) = 1 Then myDate(1) = "0" & myDate(1)
> myDate(2) = DatePart("d", CDate(sumDate))
> If Len(myDate(2)) = 1 Then myDate(2) = "0" & myDate(2)
> MyDateAdd = Join(myDate, "-")
>
> End Function
> ]]>
> </msxsl:script>
>
> </xsl:stylesheet>
>
> As I said this works fine when using MSXML. However when using
> 'System.Xml.Xsl.XslTransform' an exception is thrown when you load
the
> transform document.
> Is this functionality no longer supported in the
> 'System.Xml.Xsl.XslTransform' assembly?
>
>
> Thank you,
> John Aschenbrenner
> Ignition Mortgage Technology Solutions, Inc.
> jaschenbrenner@xxxxxxxxxxxxxxx
> Ph: (253)858-8955 x 239
> http://www.ignitionmts.com
>
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|