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:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xsp="http://apache.org/xsp";
  xmlns:byteConvert="http://www.beyarecords.com/conversion/byteConvert";
   version="1.0">

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

          return msg;
       }
     </xsp:logic>
     <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

<xsl:template match="byteConvert:convertByteArrayToImage">
  <xsp:expr>getStr()</xsp:expr>
</xsl:template>

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

</xsl:stylesheet>


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>

HTH

-Christopher



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to