RE: Calling java method

Subject: RE: Calling java method
From: Ed Simon <ed.simon@xxxxxxxxxxx>
Date: Thu, 29 Apr 1999 20:39:47 -0400
Thanks Dave,

The "extra" braces on the first parameter indeed do the trick.

I've added a second parameter (another string) and now my call, which works,
looks like this:

<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";
	xmlns:MyJava="http://www.jclark.com/xt/java/MyJava";
	indent-result="no"
	default-space="strip"
	result-ns="">

<xsl:template name="getMifForPreElements">
	<xsl:param-variable name="theText"/>
	<xsl:param-variable name="useHardReturns">false</xsl:param-variable>

	<xsl:value-of select="MyJava:dostuff( ( string($theText) ),
						string($useHardReturns) )"/>
</xsl:template>
...
</xsl:stylesheet>


The Java looks like this...

public class MyJava {
	...
	public static String getmifforpreelements(String input, String
useHardReturns) {
	...
	}
}


Personally, I have a hard time seeing why the first braces are required.  I
took
a second look at the section of the XSL spec and it isn't clear to me that
the "extra" braces
on the first parameter should really need to be there.

James, could you comment on this.

Regards,
Ed

> ----------
> From: 	Dave Pawson[SMTP:dave.pawson@xxxxxxxxxx]
> Sent: 	Thursday, April 29, 1999 8:03 AM
> To: 	ed.simon@xxxxxxxxxxx
> Cc: 	xsl list
> Subject: 	Calling java method
> 
> I was trying to get the contents of
> a source document element through to java,
> then back again, modified (eventually to
> apply braille contractions.) and added to
> the output content.
> 
> 
> My need was to obtain the content of the element,
> hence I'm using the parameter variable for this.
> I also got hold of an attribute value from the source
> document.
> 
> HTH, Regards, DaveP
> 
> 
> <!DOCTYPE xsl:stylesheet
> <!ENTITY nbsp "&#160;">
> <!ENTITY sp  "<xsl:text> </xsl:text>">
> <!ENTITY common-colour "#003300">
> ]>
> 
> 
> <xsl:stylesheet
>   xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";
>   xmlns="http://www.w3.org/TR/REC-html40";
>   xmlns:myjava="http://www.jclark.com/xt/java/TestMyJava";
>   result-ns=""
>   indent-result="yes"
>   default-space="preserve">
> 
> <xsl:template name="contract">
>    <xsl:param-variable name="p1">
>     No Content
>   </xsl:param-variable>
>   <xsl:value-of select="myjava:callme3( ( string($p1) ) )"/>
> </xsl:template>
> 
> <!-- Note the spacing in the parameters. See Working Draft,
> 6.2.7 [34] -->
> 
> <xsl:template match="para|simpara">
>    <P> <xsl:call-template name="contract">
>     <xsl:param name="p1">
>          <xsl:value-of select="." />
>    </xsl:param>
>  </xsl:call-template>
>  </P>
> </xsl:template>
> 
> 
> public static String callme3(String  text) {
> 
> return "*** " + text + " ***";
> }
> 
> 
> Output is
> <p>*** Content of para|simpara***</p>
> 
> 
> 
>  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