You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Santiago Pericas-Geertsen <Sa...@Sun.COM> on 2004/06/24 18:15:43 UTC

Re: Cannot compile stylesheet that passes Java object as template par ameter

Ralph,

 Please try the current CVS. A related bug has been fixed today. Hope it
works for you.

-- Santiago

On Wed, 2004-06-23 at 19:22, Ralph Brenner wrote:

> I am unable to compile a stylesheet that passes a Java object as a
> parameter to a template.  For example, when trying to pass a Java
> String, I get the following error:
> 
>     Cannot convert data-type 'java.lang.String' to 'reference'.
> 
> However, I am able to successfully process the template when I do not
> compile it.
> 
> e.g. this does not work:
>    java org.apache.xalan.xsltc.cmdline.Compile example.xsl
> 
> But this works:
>    java org.apache.xalan.xslt.Process -XSL example.xsl
> 
> Here is an example XSL file which illustrates the problem:
> 
> example.xsl:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:java="http://xml.apache.org/xalan/java"
>     version="1.0">
>     
>     <xsl:template match="/">
>         <xsl:variable
>             name="javaString"
>             select="java:java.lang.String.new('java variable test')"/>
>         <xsl:call-template name="aTemplate">
>             <xsl:with-param name="javaString" select="$javaString"/>
>         </xsl:call-template>
>     </xsl:template>
> 
>     <xsl:template name="aTemplate">
>         <xsl:param name="javaString"/>
>         <xsl:value-of select="$javaString"/>
>     </xsl:template>
> </xsl:stylesheet>
> 
>