Dear All,
I get a compile error from the Java code generated by my logic sheet. I'm trying to implement a logic sheet that looks up a value given an id. I'm calling it from an XSP page as follows: <dbutil:idlookup table="Clients"> <xsp-request:get-parameter name="clientId"/> </dbutil:idlookup> The dbutil logic sheet makes use of the esql logicsheet. dbutil:idlookup performs, more or less, the following: <xsl:template match="dbutil:idlookup"> <esql:collection> ... <esql:query> select name from Clients where clientId = <xsl:value-of select=".|text()"/> ... Note the select=".|text()". I was hoping for text in the right hand side of the where clause. I got the XML tag '<xsp-request:get-parameter..>'. In fact, I had hoped that the idlookup tag would contain the text representation my client id (e.g. '1') at evaluation time. I find instead that Cocoon is attempting to replace the get-parameter with a Java call, which (logically speaking) generates a select that looks like this: select name from Clients where clientId = <xsp-request:get-parameter name="clientId"/> This would be fine except that the select statement is apparently treated internally as a string and when processed by the generator, it creates JSP code that looks like this (Slightly adjusted and line-wrapped to make it more readable): _esql_query = new EsqlQuery( _esql_connection, String.valueOf( "select name from Clients where clientId = (XSPRequestHelper.getParameter(objectModel, "clientId", null, null, null) ) " ) ); Note the embedded Java method call in the literal string. This causes the problem. (I suppose I should consider myself lucky that the method call generated a syntax error instead of failing silently :) My obvious question is: How do I get around this? I considered moving the DB part to a transformer, but then I will get all sorts of dependencies in my sitemaps, and I would prefer the 'one stop shopping' that logicsheets should be able to provide. It there any way to do this with a pure logicsheet solution? Any suggestions? Best wishes and thanks in advance, Alan. P.S. Food for thought: <meta-issue> Note: This problem belongs the class of 'eval' errors, where code gets generated and quoting disturbs its complete evaluation. In this case the shift from evaluation by the Java compiler, which generates the JSP code, to the DB server, which evaluates the SQL statement, is the ultimate source of the problem. There may be other places in Cocoon where this can happen. </meta-issue> --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>