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

Microsoft's .Net XML 'System.Xml.Xsl.XslTransform' and

Subject: Microsoft's .Net XML 'System.Xml.Xsl.XslTransform' and Scripting
From: John Aschenbrenner <jaschenbrenner@xxxxxxxxxxxxxxx>
Date: Tue, 14 Jan 2003 10:20:59 -0800
system.xml.xsl.xsltransform
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


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.