On Thu, 3 Jun 1999, Steve Ball wrote:

> Dear Tclers,
> 
> I am working on creating a Tcl extension to James Clark's XT XSL processor,
> using TclBlend.
> 
> This seems to boil down to being able to access the Tcl interpreter via a
> static public class.  The trouble is, there doesn't appear to be a
> static class
> that refers to the main Tcl interpreter in Java.  However, I notice in
> the source
> code (yes, I UTSL'd) that an Interp object is created to wrap around the pointer
> to the C Tcl_Interp structure and that gets squirreled away in a
> variable of the
> Interp class.  I figure that all I need is a static class that returns that
> object.
> 
> Perhaps an example would illustrate what I'm trying to do.
> 
> Here is a XSL stylesheet.  XT provides a mechanism to callback into a
> public static
> Java class by referring to that class using a namespace that refers to a
> UIR prefixed
> by "http://www.jclark.com/xt/java/".  In an XSL template you then invoke
> a method
> of that class by referring to the XML namespace.
> 
> <xsl:stylesheet
>   xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
>   xmlns:tcl="http://www.jclark.com/xt/java/tcl.lang.Interp"   <!--
> declare tcl namespace -->
>   xmlns="http://www.w3.org/TR/REC-html40"
>   result-ns="">
> 
> <xsl:template match="/">
>   <html>
>     <xsl:if test="function-available('tcl:eval')">  <!-- use the tcl
> namespace -->
>       <p><xsl:value-of select='tcl:eval("clock format [clock seconds]")'/></p>
>     </xsl:if>
>   </html>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> This doesn't work because tcl.lang.Interp is not a static class.
> If there were a public static class, say tcl.lang.Interp.getInterp, that just
> referred to the main interpreter then my example would be:
> 
> <xsl:stylesheet
>   xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
>   xmlns:tcl="http://www.jclark.com/xt/java/tcl.lang.Interp.getInterp"
>   xmlns="http://www.w3.org/TR/REC-html40"
>   result-ns="">
> 
> <xsl:template match="/">
>   <html>
>     <xsl:if test="function-available('tcl:eval')">
>       <p><xsl:value-of select='tcl:eval("clock format [clock seconds]")'/></p>
>       <p><xsl:value-of select='tcl:eval('set a "XSL Rules")'/></p>
>       <p><xsl:value-of select='tcl:getVar('a")'/></p>
>     </xsl:if>
>   </html>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> I think that would work.

Nope, no chance. There is no "static" class because you should be able
to have more than one interp in a process. You should be able to create
a single interp in the process and access it within you Java code with
no problems. Just make a static reference to an interpreter reference.

I hope that helps
mo
 
> Any chance of having that public static class added to TclBlend?
> 
> Cheers,
> Steve Ball
> 
> ----------------------------------------------------------------
> The TclJava mailing list is sponsored by WebNet Technologies.
> To subscribe:    send mail to [EMAIL PROTECTED]  
>                  with the word SUBSCRIBE as the subject.
> To unsubscribe:  send mail to [EMAIL PROTECTED] 
>                  with the word UNSUBSCRIBE as the subject.
> To send to the list, send email to '[EMAIL PROTECTED]'. 
> A list archive is at: http://www.findmail.com/listsaver/tcldallas/
> 

----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
A list archive is at: http://www.findmail.com/listsaver/tcldallas/

Reply via email to