For an example, look at:

http://wiki.apache.org/cocoon/HowToCreateHiearchicalXmlUsingESQL 


>>> [EMAIL PROTECTED] 2005/06/29 02:44:01 PM >>>
Hi,
I'm trying to pass variables from the results of a query to another  
query in the same xsp page: this is the code

<?xml version="1.0"?>

<xsp:page language="java"
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
           xmlns:xsp="http://apache.org/xsp";
           xmlns:esql="http://apache.org/cocoon/SQL/v2";
           xmlns:xsp-request="http://apache.org/xsp/request/2.0";>

<text>
     <xsl:param name="id_rst"/>

     <esql:connection>
         <esql:pool>teosoficaDB</esql:pool>
         <xsl:if test="$id_rst">
             <esql:execute-query>
             <esql:query>SELECT rst_child FROM relstruttura
                         WHERE id_rst=<esql:parameter><xsp- 
request:get-parameter name="id_rst"/></esql:parameter>
             </esql:query>
             <esql:results>
                 <esql:row-results>
                     <esql:get-string column="rst_child"/>  <!-- this  
is the value I want to use below in the page -->
                 </esql:row-results>
             </esql:results>
             </esql:execute-query>
             <esql:execute-query>
                 <esql:query>SELECT st_tit,id_rst FROM  
dbstruttura,relstruttura
                         WHERE  
dbstruttura.id_sez=relstruttura.rst_child AND
                         rst_parent=<esql:parameter><xsp-request:get- 
parameter name="id_rst"/></esql:parameter>
                 </esql:query>
             <esql:results>
                     <esql:row-results>
                         <esql:get-string column="st_tit"/>
                     </esql:row-results>
             </esql:results>
             <esql:no-results>
                 <esql:execute-query>
                 <esql:query>SELECT ar_tit,id_art FROM dbarticoli
                             WHERE ar_sez=  <!-- PARAM!! here the  
value of column rst_child of the first query -->
                 </esql:query>
                 <esql:results>
                     <esql:row-results>
                         <esql:get-string column="ar_tit"/>
                     </esql:row-results>
                 </esql:results>
                 </esql:execute-query>
             </esql:no-results>
             </esql:execute-query>
         </xsl:if>
     </esql:connection>
</text>
</xsp:page>

The code is working if I use test values for the last query but I  
don't know how to set a local variable with the value of the esql:get- 
string ....


Thank for your suggestions



:-)Franco Andrao
[EMAIL PROTECTED] 



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

Reply via email to