RE: [xsl] Xalan-Java extensions

Subject: RE: [xsl] Xalan-Java extensions
From: Zeynep Gunal <z.gunal@xxxxxxxxxxxxxxxx>
Date: Fri, 23 Mar 2001 09:20:31 +0100
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: [xsl] 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


Current Thread