Not ackd. As usual, the appropriate place to ask Xalan questions is on one of the *Xalan* team mailing lists, either [EMAIL PROTECTED] (where I'm forwarding this for you) or [EMAIL PROTECTED] Information about subscribing to these lists or viewing the archives is at http://xml.apache.org/mail.html Contacting individual developers is a Bad Idea, unless you happen to know them personally, especially when they haven't had enough coffee in the morning. ----- Forwarded by Shane Curcuru on 09/17/2002 08:53 AM ----- From: "Rony G. Flatscher" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] Hi there, in the context of experimenting with XSL-extensions, implementing them with a non-Java-language, i.e. a self-developed RexxEngine (supporting IBM's Object Rexx on Linux, OS/2, Windows, and the opensource Rexx interpreter "Regina" on Linux and Windows), I had a student experiment with extensions. The problem: what works with JavaScript does not work with Rexx (the JavaScript extension example is enclosed, the JavaScript part should get replaced with a Rexx program as a proof of concept). The RexxEngine extends BSFEngineImpl, is loaded and call() is invoked. Unfortunately, the method call() does not receive the source-code (i.e. the Rexx code) but only the name of the function and the arguments. The question: how would one be able to get a hold of the source code at runtime? (Where is the program source of the script located?) Any hint would be highly appreciated! --- [With eval(), exec() and apply() all the arguments are more clearly defined compared to call(). Actually, I would have expected that apply() would be invoked instead of call(). call() is obviously meant for invoking a given method on a known object in the target scripting environment, hence my surprise that call() is used within the Xalan extension mechanism and not apply().] Also, please do not be offended, if I address all of you, who are known to be Xalan-implementors. It's just a sign of the high level of despair (due to strong time-restrictions and work-overload) and the hope that maybe one of you may be able to anwer this quickly and without too much effort. (The student, a non-Informatic student, has been trying for three months to solve the problem, I started two weeks ago to look into it and started out studying the e-mail archives of cocoon and posted questions there to no avail, now concentrating on Xalan, but have not found any information on this. The BSF-discussion list was not used yet, because its posting intensity is very low and I would not expect any help from there.) Thank you very much for *any* hint/help in advance ! Regards, Rony G. Flatscher <?xml-stylesheet type="text/xsl"> XML nach HTML Dies ist das Ergebnis der Transformation einer XML-Seite in das HTML-Format Die Differenz beträgt zwischen dem Tag der Abgabe: Sun Jun 30 2002 00:00:00 GMT+0200 (CEST) und heutigem Tage: Tue Jul 30 2002 00:34:36 GMT+0200 (CEST) 30 Tage und wird daher nicht mehr toleriert.<?xml version="1.0"?> <!DOCTYPE page [ <!ELEMENT page (title?, content)> <!ELEMENT title (#PCDATA)> <!ELEMENT content (para+)> <!ELEMENT para (#PCDATA)> ]> <?xml-stylesheet type="text/xsl"?> <page> <title>XML nach HTML</title> <content> <para>Dies ist das Ergebnis der Transformation einer XML-Seite in das HTML-Format</para> <deadline duedate="June 30, 2002"/> </content> </page> <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:my-ext="ext1" extension-element-prefixes="my-ext"> <xsl:param name="view-source"/> <xsl:template match="page"> <html> <head> <title> <xsl:value-of select="title"/> </title> </head> <body bgcolor="white" alink="red" link="blue" vlink="blue"> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="title"> <h2 style="color: navy; text-align: center"> <xsl:if test="not($view-source)"> <xsl:apply-templates/> </xsl:if> <xsl:if test="$view-source"> <A> <xsl:attribute name="HREF">../view-source?filename=/<xsl:value-of select="$view-source"/></xsl:attribute> <xsl:attribute name="TARGET">_blank</xsl:attribute> <xsl:apply-templates/> </A> </xsl:if> </h2> </xsl:template> <xsl:template match="para"> <p align="left"> <i><xsl:apply-templates/></i> </p> </xsl:template> <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template> <!--The component and its script are in the lxslt namespace and define the implementation of the extension. --> <lxslt:component prefix="my-ext" elements="timelapse" functions="getdate"> <lxslt:script lang="javascript" > <![CDATA[ function getdate(duedate) { var date = new Date(duedate); var now = new Date(); var diff = now.getTime() - date.getTime(); var days = Math.floor(diff / (1000 * 60 * 60 * 24)); if (days < 7) { var data = "Die Differenz beträgt zwischen dem Tag der Abgabe: " + date + " und heutigem Tage: " + now + " " + days + " Tage und wird daher noch toleriert."; return data; } else if (days > 7) { var data = "Die Differenz beträgt zwischen dem Tag der Abgabe: " + date + " und heutigem Tage: " + now + " " + days + " Tage und wird daher nicht mehr toleriert."; return data; } else if (days == 7) { var data = "Die Differenz beträgt zwischen dem Tag der Abgabe: " + date + " und heutigem Tage: " + now + " genau " + days + " Tage und wird daher gerade noch toleriert."; return data; } else { var data = "It's already done!"; return data; } }]]> </lxslt:script> </lxslt:component> <xsl:template match="deadline"> <p> <xsl:value-of select="my-ext:getdate(string(@duedate))"/> </p> </xsl:template> </xsl:stylesheet> <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:my-ext="ext1" extension-element-prefixes="my-ext"> <xsl:param name="view-source"/> <xsl:template match="page"> <html> <head> <title> <xsl:value-of select="title"/> </title> </head> <body bgcolor="red" alink="red" link="blue" vlink="blue"> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="title"> <h2 style="color: navy; text-align: center"> <xsl:if test="not($view-source)"> <xsl:apply-templates/> </xsl:if> <xsl:if test="$view-source"> <A> <xsl:attribute name="HREF">../view-source?filename=/<xsl:value-of select="$view-source"/></xsl:attribute> <xsl:attribute name="TARGET">_blank</xsl:attribute> <xsl:apply-templates/> </A> </xsl:if> </h2> </xsl:template> <xsl:template match="para"> <p align="left"> <i><xsl:apply-templates/></i> </p> </xsl:template> <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template> <!--The component and its script are in the lxslt namespace and define the implementation of the extension.--> <lxslt:component prefix="my-ext" elements="timelapse" functions="calctime"> <lxslt:script lang="rexx"> <![CDATA[ /* calctime rexx - Object Rexx, ---rgf, 2002-07-30, 03:03, wuw */ parse arg mon +3 . day "," year /* parse date */ due_date = date("s", space(day mon year), "n") /* convert to a sortable date */ due_days = date("b", due_date, "s") /* convert to days since 0001-01-01 */ today = date("l") /* get today in a sortable date */ today_days = date("b") /* convert to days since 0001-01-01 */ days=today_days-due_days /* calc difference of days */ due_date = date("L", due_date, "s") /* convert to language format */ if days<7 then return ("Die Differenz beträgt zwischen dem Tag der Abgabe:" due_date "und heutigem Tage:" today days "Tage und wird daher noch toleriert.") else if days=7 then return "Die Differenz beträgt zwischen dem Tag der Abgabe:" due_date "und heutigem Tage:" today days "Tage und wird daher gerade noch toleriert." else /* nur mehr der Fall möglich, dass "days>7" ist ! */ return ("Die Differenz beträgt zwischen dem Tag der Abgabe:" due_date "und heutigem Tage:" today days "Tage und wird daher nicht mehr toleriert.") ]]> </lxslt:script> </lxslt:component> <xsl:template match="deadline"> <xsl:value-of select="my-ext:calctime(string(@due_date))"/> </xsl:template> </xsl:stylesheet>
