[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Xalan-Java extensions
Chris, Thanks for trying. Having had already written (with Jeni's help) a mini embedded javascript, I first tried <lxslt:component> <lsxslt:script lang=javascript> combination to solve this problem too, but my understanding is that file I/O operations are not supported by javascript. Replacing javascript with JScript did not help, either. Cheers, Zeynep -----Original Message----- From: Chris Bayes [mailto:Chris@xxxxxxxxxxx] Sent: Wednesday, March 21, 2001 9:11 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: Xalan-Java extensions This is a step closer <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:mynamespace="extl" xmlns:lxslt="http://xml.apache.org/xslt" extension-element-prefixes="mynamespace" exclude-result-prefixes="mynamespace"> <lxslt:component prefix="mynamespace" elements="appendtolog" functions="appendtolog"> <lxslt:script lang="javascript"> function appendtolog(){ var fso, tf, a, ForAppending; ForAppending = 8; logString = "Testing.."; logFileName = "c:\\testlog.txt"; fso = new ActiveXObject("Scripting.FileSystemObject"); if (fso.FileExists(logFileName)) tf = fso.OpenTextFile(logFileName, ForAppending, false); else tf = fso.CreateTextFile(logFileName, true); // Write the input string with a newline character. tf.WriteLine(logString) ; tf.Close(); } </lxslt:script> </lxslt:component> <xsl:template name="append-to-log"> <xsl:param name="log-string" select="." /> ====++ <xsl:value-of select="mynamespace:appendtolog()" /> </xsl:template> </xsl:stylesheet> But I get ========= Parsing file:C:/TEMP/main.xsl ========== Parse of file:C:/TEMP/main.xsl took 1484 milliseconds ========= Parsing main.XML ========== Parse of main.XML took 110 milliseconds ============================= Transforming... Call to extension function failed: unable to load language: javascript Call to extension function failed: unable to load language: javascript Call to extension function failed: unable to load language: javascript ====++ ====++ ====++ transform took 375 milliseconds XSLProcessor: done Maybe it will work for you. Ciao Chris XML/XSL Portal http://www.bayes.co.uk/xml XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|