cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Painter-Wakefield <>
Subject Re: Problems with custom taglib
Date Fri, 13 Feb 2004 15:06:00 GMT

To do a logicsheet, you need to keep in mind that what you are doing is
creating an XSLT stylesheet to transform your code into valid XSP code.
Your template certainly won't do that, because you are mixing class level
logic (function definition) with method level logic (bare call to function)
in the same template.  If you use this template inside your page element,
you'll have a function definition inside the generate() method of the final
java code, which obviously won't compile.  If you use the template outside
your page element, you'll have a call to "getStr()" at the class level,
outside any function, which obviously won't compile.  What you want is a
stylesheet that will put your function in at the class level (e.g., inside
xsp:page, but outside any non-xsp elements), and your call to the function
inside the method.  So, try this instead:

<?xml version="1.0"?>

<xsl:template match="xsp:page">
     <xsl:apply-templates select="@*"/>
       private static String getStr()
          String msg = "testing.....";

          return msg;

<xsl:template match="byteConvert:convertByteArrayToImage">

<xsl:template match="@*|node()" priority="-1">
     <xsl:apply-templates select="@*|node()"/>


If you want to create the getStr() method only when the
byteConvert:convertByteArrayToImage template is used, then you can wrap the
xsp:logic block in an xsl:if block:
<xsl:if test="*//byteConvert:convertByteArrayToImage"> ... </xsl:if>



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message