Hi cocooners!
I know that esql:get-row-count is unavailable yet. But I need to get this
information from my DB.
I try:
dbman.xsl
<!--
- get employees count from database
-->
<xsl:template match="dbman:employees-count">
<count>
<esql:connection>
<esql:pool>mydb</esql:pool>
<esql:execute-query>
<esql:query>
select count(*) CNT
from EMP
</esql:query>
<esql:results>
<esql:row-results><esql:get-string column="CNT"/></esql:row-results>
</esql:results>
<esql:no-results>0</esql:no-results>
</esql:execute-query>
</esql:connection>
</count>
</xsl:template>
in my logicsheet.
But I have trouble when I try to pass this value by using
<dbman:employees-count/> as an attribute or xml entity to another
logicsheet:
any.xml
<batch:navigator wrap="no">
<batch:action>employees</batch:action>
<batch:batch><xsp-session:get-attribute
name="employee-batch"/></batch:batch>
<batch:batch-size><xsp-session:get-attribute
name="employee-batch-size"/></batch:batch-size>
<batch:element-count><dbman:employees-count/></batch:element-count>
</batch:navigator>
in my XML/XSP document.
"batch" and "dbman" are my own logicsheets registered in cocoon.xconf -
dbpool is registered too and dbdriver of course in web.xml.
batch.xsl
<xsl:template match="batch:navigator">
<xsl:param name="element-count" select="batch:element-count"/>
<batch-navigator>
<batch-count>
<xsp:expr>
(Long.parseLong(<xsl:value-of select="$element-count"/>) - 1) /
Long.parseLong(<xsl:value-of select="$batch-size"/>.toString()) + 1
</xsp:expr>
</batch-count>
<element-count>
<xsp:expr><xsl:value-of select="$element-count"/></xsp:expr>
</element-count>
</batch-navigator>
</xsl:template>
When I see into compiled java files I have NOTHING:
this.contentHandler.startElement(
"",
"element-count",
"element-count",
xspAttr
);
xspAttr.clear();
/*
* AND? HERE SHOULD BE <xsl:value-of select="$element-count"/>!!
* why it isn't???
*/
this.contentHandler.endElement(
"",
"element-count",
"element-count"
);
What is the trouble with passing parameters between logicsheets?
Please help.
Jerzy Kut
---------------------------------------------------------------------
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]>