Hi, about <xsp:logic> tags: it is quite strange. I agree that ist should not work when I use <xsp:logic> tags to do some output. But in fact it worked (and it did not work with <xsp:expr>.
Could this be because it is called between some esql tags that use logic themselves. Something like that my tags are called in a xsp:expr context? I have no idea. Besides this my problem was basically tue to the fact, that I tried to use xsl variables with java content. For the moment I wrote a little less dynamic page that works well. But this will not be the final state and I think I will try out java variables. But: on the cocoon site I found about variables * Even when using enclosing braces around the <xsp:logic> section, there's always the risk that the page author (or another logicsheet!) has previously defined variables called myConnection, previousConnection or mySession. This will result in multiply-defined variable compilation errors What do I have to take care about to bypass problems like that? Some other question: see bottom >> From: Peter Wieland [mailto:[EMAIL PROTECTED]] >> >> Hi, >> >> I'm trying for one day to get a logicsheet to do some work >> for me. I want to print out a drop down menu with values from >> a database and the format speciefied in my xsp source. >> >> here is the relevant part of the xsp-page (test.xsp) >> --------------------------------- >> <list> >> <tiana-sql:listboxitems table="TianaUser"> >> <tiana-sql:itemelement >> type="column">Id</tiana-sql:itemelement> >> <tiana-sql:itemelement type="text"> - </tiana-sql:itemelement> >> <tiana-sql:itemelement >> type="column">FirstName</tiana-sql:itemelement> >> <tiana-sql:itemelement type="text"> </tiana-sql:itemelement> >> <tiana-sql:itemelement >> type="column">LastName</tiana-sql:itemelement> >> </tiana-sql:listboxitems> >> </list> >> --------------------------------- >> >> and some parts of my tiana-sql logicsheet >> --------------------------------- >> <xsl:template name="get-columns"> >> <xsl:for-each select="tiana-sql:itemelement[@type='column']"> >> <xsl:text>, </xsl:text> >> <xsp:logic>TianaSQLHelper.getTablePrefix(objectModel, >> "<xsl:value-of >> select="parent::*/@table"/>")</xsp:logic><xsl:value-of select="."/> >> </xsl:for-each> >> </xsl:template> > If you are going to output something with this code then you should use > <xsp:expr> instead of <xsp:liogic> >> >> <xsl:template match="tiana-sql:listboxitems[@table]"> >> <xsl:variable name="idcolumn"> >> <xsp:logic>TianaSQLHelper.getIdColumn(objectModel, >> "<xsl:value-of select="@table"/>")</xsp:logic> > This won't work: logicsheet is applied before any code is run, so you > can't > assign a value to XSL variable. Use normal Java variables for that. >> </xsl:variable> >> >> <xsl:variable name="in-cond"> >> <xsl:if test="@in-cond"> WHERE <xsl:value-of >> select="$idcolumn"/> IN (<xsl:value-of select="@in-cond"/>)</xsl:if> >> </xsl:variable> >> >> <esql:connection> >> <esql:pool>tiana</esql:pool> >> <esql:execute-query> >> <esql:query> >> <xsl:text>SELECT </xsl:text> >> <xsp:logic>TianaSQLHelper.getIdColumn(objectModel, >> "<xsl:value-of select="@table"/>")</xsp:logic> > The same is here: use xsp:expr >> <xsl:text> AS Id</xsl:text> >> <xsl:call-template name="get-columns"/> >> <xsl:text> FROM </xsl:text><xsl:value-of select="@table"/> >> <xsl:value-of select="$in-cond"/> >> </esql:query> >> <esql:results> >> <esql:row-results> >> <item> >> <value><esql:get-string column="Id"/></value> >> <text> >> <xsl:for-each select="tiana-sql:itemelement"> >> <xsl:choose> >> <xsl:when test="@type='text'"> >> <xsl:value-of select="."/> >> </xsl:when> >> <xsl:when test="@type='column'"> >> <!--<esql:get-string> >> <esql:column>--> >> >> <xsp:logic>TianaSQLHelper.getTablePrefix(objectModel, >> "<xsl:value-of select="parent::*/@table"/>") + "<xsl:value-of >> select="."/>"</xsp:logic> > And here >> <!--</esql:column> >> </esql:get-string>--> >> </xsl:when> >> </xsl:choose> >> </xsl:for-each> >> </text> >> </item> >> </esql:row-results> >> </esql:results> >> </esql:execute-query> >> </esql:connection> >> </xsl:template> >> --------------------------------- > Although, I might have understood your code a little wrong. See my > logicsheet sample: > http://www.cocooncenter.org/cc/documents/resources/logicsheet/index.html - > this is a simple demonstration of what you are going to achieve. >> >> This works fine as long as I comment out the part, where I >> actually do the db request (I just get the names of the >> columns printed out, instead of the columns). But if I >> include this request, I get class not found exceptions, what >> is not very surprising as an empty test_xsp.java file is >> generated. But why is this file empty. When I use <xsp:expr> >> ... </> instead of logic, I get an compile error because of a >> missing ";" in my test_xsp.java. > You are mixing your code with ESQL's, this can be the cause of the > problem. I'm sure, this is the cause of my problem and this is my problem. As I want to use the results of my code to "configure" the esql parts, I don't see how to avoid this. My source file defines the columns to read from the table. My code translates this to a select command and to the several queries. What's a little strange is that I get the fine result to generate the select command but it doesn't work for the get-string calls. Peter --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>