Hi! Thank You Christian and Torsten! I solved my trouble :)) First! I make my "SELECT count(*) CNT from <table>" as method in JAVA:
dbman.xsl - logicsheet in dbman namespace <xsl:template match="xsp:page"> <xsp:page> <xsl:apply-templates select="@*"/> <xsp:logic> /** * Get table rows count from database. * Makes SQL count(*) query on table and return result as Long. * @param pool database pool name (defined in cocoon.xconf) * @param table name of table which rows will be accounted * @return count of employees */ private Long getRowsCount(String pool, String table) { // database query String query = "select count(*) CNT " + "from " + table; // database column name String column = "CNT"; // returned employees count value Long count = new Long(0); try { EsqlConnectionCocoon2 sqlConnection = new EsqlConnectionCocoon2(); sqlConnection.datasource = // _esql_selector is private static property of ESQL (DataSourceComponent)_esql_selector.select(pool); sqlConnection.connection = sqlConnection.datasource.getConnection(); EsqlQuery sqlQuery = new EsqlQuery(sqlConnection, query); sqlQuery.createStatement(); sqlQuery.execute(); if (sqlQuery.hasResultSet()) { sqlQuery.getResultRows(); if (sqlQuery.nextRow()) { count = new Long(sqlQuery.getResultSet().getInt("CNT")); } } sqlQuery.getResultSet().close(); } catch (Exception exception) { exception.printStackTrace(); } return (count); } </xsp:logic> <xsl:apply-templates/> </xsp:page> </xsl:template> <!-- - get graduations count from database --> <xsl:template match="dbman:graduations-count"> <xsp:expr>getRowsCount("mydb", "SALGRADE")</xsp:expr> </xsl:template> This inserts my method in proper place of class :)) Then I can use <dbman:graduations-count/> to get count of salary graduations. It isn't final form but now it works quite good :)) Second! In my navi logicsheet i use <xsl:copy-of> instead <xsl:value-of> tag: batchnavi.xsl - logicsheet in batch namespace <xsl:template match="batch:navigator"> <xsl:param name="batch" select="batch:batch/*"/> <xsl:param name="batch-size" select="batch:batch-size/*"/> <xsl:param name="element-count" select="batch:element-count/*"/> <xsl:param name="action" select="batch:action/*"/> <xsl:param name="wrap" select="@wrap"/> <xsl:variable name="batch-count"> <xsp:expr> (Long.parseLong(<xsl:copy-of select="$element-count"/>.toString()) - 1) / Long.parseLong(<xsl:copy-of select="$batch-size"/>.toString()) + 1 </xsp:expr> </xsl:variable> </xsl:template> It inserts calling of getRowsCount(...) method directly from <xsp:expr> in compiled JAVA code. It try to insert whole method body there before. Now it works :) At last! I don't change my main XML/XSP document: main.xml - my XSP document <batch:navigator wrap="yes"> <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> That's all! Very, very big thanks for help. That was trouble with xslt processing indeed :)) ! But I have impression You keep in mind another resolve Christian ??? With JAVA BEANS. Best regards Jerzy Kut ----- Original Message ----- From: "Christian Haul" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 17, 2002 9:33 AM Subject: Re: esql based logicsheet get-row-count > On 17.Apr.2002 -- 09:10 AM, Jerzy Kut wrote: > > Hi cocooners! > > I know that esql:get-row-count is unavailable yet. But I need to get this > > information from my DB. > > I try: > > > <batch:element-count><dbman:employees-count/></batch:element-count> > > > batch.xsl > > <xsl:template match="batch:navigator"> > > <xsl:param name="element-count" select="batch:element-count"/> > > > (Long.parseLong(<xsl:value-of select="$element-count"/>) - 1) / > > OK, this is no briliant analysis of your code and certainly will not > readily solve your problem, however, you have an XSL problem here: > > The last line is going to be expanded to something like > > (Long.parseLong(<count><esql:connection><esql:query>.....</esql:connection>< /count>)-1 > > which certainly was not your intention. > > If you pass parameters this way, make sure that your templates really > expand to a single text node (in the end). This is not like calling > functions but programming with macros. Bear that in mind! > > You might want to use java beans to communicate. > > Anyway, this is not a trivial problem and I bet most new-comers hit > this wall at some time. > > Chris. > > -- > C h r i s t i a n H a u l > [EMAIL PROTECTED] > fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 > > --------------------------------------------------------------------- > 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]> --------------------------------------------------------------------- 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]>