Ok,

suppose your url looks like: 

myurl?cust_id=123

Your sitemap looks like:

<map:match pattern="myurl">
        <map:generate src="xml/custdata_query.xml"/> 
        <map:transform type="sql">
                <map:parameter name="cust_id" value="{request-param:cust_id}"/>
            <map:parameter name="use-connection" value="mbrdb"/>
        </map:transform>
        <map:transform src="somexsl.xsl">
                <map:parameter name="cust_id" value="{request-param:cust_id}"/>
        </map:transform>
        <map:serialize type="xhtml"/>
</map:match>

Your custdata_query.xml could look like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0";>
   <sql:query name="cust_data">
    SELECT  col1, col2, col3
    FROM  cust_table
    WHERE  cust_id = <sql:substitute-value sql:name="cust_id"/>
    </sql:query>      
</sql:execute-query> 

from the sitemap the cust_id is substituted by the sql transformer.

Then the query is executed and the sql transformer returns xml.

Furthermore, you can transform with some other xsl, which could look like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
  xmlns:sql="http://apache.org/cocoon/SQL/2.0";
  exclude-result-prefixes="sql"
  >

<xsl:param name="cust_id"/>
<xsl:template match="/">
        <yi>
                <xsl:value-of select="$cust_id"/>
                <xsl:copy-of select="."/>
        </yi>
</xsl:template>
</xsl:stylesheet> 


Then I think you have everything you need. Don't forget to include in your 
sitemap:
<map:transformers>
<map:transformer name="sql" 
src="org.apache.cocoon.transformation.SQLTransformer" 
logger="sitemap.transformer.sql"/>
</map:transformers>

and 
<map:selectors default="parameter">
        <map:selector name="request-parameter"
                    src="org.apache.cocoon.selection.RequestParameterSelector"  
                                              
logger="sitemap.selector.requestparameter"/>
</map:selectors>

This should be it, have fun

AS


> 
> 
> Ard,
> 
> I am not getting that parameter picked on the XSL page,
> not sure about XML one (with queries), can't see it.
> Actually, is there a way to see the output of that SQL
> transformer ?
> 
> Could you please give me a sample of
> XSL file processing that rowset (to display it on the screen)?
> Mine (below) is not working.
> 
> And please look at my 5 questions.  
> 
> TIA,
> Oleg.
> 
> 
> --- Ard Schrijvers <[EMAIL PROTECTED]> wrote:
> 
> > I dont understand your query file. What you should do is very
> > simple:
> > 
> > sitemap part:
> > <map:transform type="sql">
> >        <map:parameter name="cust_id" value="{cust_id}"/>
> >        <map:parameter name="use-connection" value="mbrdb"/>
> >        <map:parameter name="show-nr-of-rows" value="true"/>
> > </map:transform>
> > 
> > query part
> > 
> >  <content>  
> >  <sql:execute-query>
> >    <sql:query name="cust_data">
> >      SELECT  col1, col2, col3
> >      FROM  cust_table
> >      WHERE  cust_id = <sql:substitute-value
> > sql:name="cust_id"/>
> >    </sql:query>
> >    </sql:execute-query>
> >  .... 
> >  </content>
> > 
> > That is al. The map:paramter cust_id is by the sql transformer
> > placed in <sql:substitute-value sql:name="cust_id"/>
> > 
> > Do not use the xsl:param name="param1" and try to place this
> > value in the sql:subsitute. Did not read your entire mail but
> > think this should solve at least the piece of code I saw,
> > 
> > AS
> > 
> > 
> > > 
> > > Hi,
> > > 
> > > I am trying to implement a popup which displays
> > > on the screen data from several SQL queries (with parameter
> > > passed, e.g.  "myurl?param1=123") using sitemap actions
> > > with Cocoon 2.0.4. It is an addition to a large Cocoon app,
> > > but none of older developers is around anymore. 
> > > I am Cocoon newbie (was trying to follow their style,
> > > but there are no similar things in that app).
> > > 
> > > So far I am getting a popup with parameter passed,
> > > but it XSL page that parameter isn't getting picked up.
> > > Instead I am getting on a screen a query text:
> > >  "select ... from ... where cust_id=".
> > > 
> > > Here is what I have in sitemap:
> > > <map:match pattern="custdata_popup">  
> > >   <map:act type='request'>
> > >     <map:parameter name="parameters" value="true"/>
> > >     <map:generate src='xml/custdata_query.xml'/>
> > >     <map:transform type="sql">
> > >       <map:parameter name="cust_id" value="{cust_id}"/>
> > >       <map:parameter name="use-connection" value="mbrdb"/>
> > >       <map:parameter name="show-nr-of-rows" value="true"/>
> > >     </map:transform>
> > >     <map:transform type="xslt"
> > > src="xslt/mbr/change_custdata_popup.xsl">
> > >       <map:parameter name="use-request-parameters"
> > > value="true"/>
> > >     </map:transform>
> > >     <map:serialize type="html"/>
> > >   </map:act>
> > > </map:match>
> > > 
> > > Here is a piece from the query file:
> > > <xsl:param name='param1'/>
> > > <content>  
> > > <sql:execute-query>
> > >   <sql:query name="cust_data">
> > >     SELECT  col1, col2, col3
> > >     FROM  cust_table
> > >     WHERE  cust_id = <sql:substitute-value
> > sql:name="param1"/>
> > >   </sql:query>
> > >   </sql:execute-query>
> > > .... 
> > > </content>
> > > 
> > > It seems that it is totally ignored,
> > > at least XSL doesn't seem to get any output from
> > SQLTransformer.
> > > So I tried to execute that Select there directly.
> > > 
> > > Here is a main piece of my XSL file:
> > > <?xml version='1.0' encoding='UTF-8'?>
> > > <xsl:stylesheet version='1.0'
> > > xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
> > > xmlns:sql="http://apache.org/cocoon/SQL/2.0";>
> > > <xsl:param name='param1'/>
> > > 
> > > <xsl:variable name='thedata'
> > > select='/page/content/paging/data'/>
> > > 
> > > <xsl:template match="/">
> > >   <page>
> > >           <title>Customer Data popup</title>
> > >           <content>
> > >                   <xsl:apply-templates />
> > >                   <sql:execute-query>
> > >                           <sql:query>
> > >                              SELECT  col1, col2, col3
> > >     FROM  cust_table
> > >     WHERE  cust_id = <sql:substitute-value
> > sql:name="param1"/> 
> > >                           </sql:query>
> > >                   </sql:execute-query>
> > >           </content>
> > >   </page>
> > > </xsl:template>
> > > 
> > > <xsl:template name='page-main'> 
> > >   <form name="myformname" id="myform" method="post"
> > > action="myaction">
> > > <table 
> > > <thead>
> > > ...
> > > </thead>
> > >   <tbody>
> > >     <xsl:for-each select='$thedata/row'>
> > >       <xsl:call-template name='row'>
> > >   <xsl:with-param name='therow' select='.'/>
> > >       </xsl:call-template>
> > >   </xsl:for-each>
> > >   </tbody>
> > > </table>
> > > </form>
> > > </xsl:template>
> > > 
> > > 
> > > <xsl:template name="row">
> > >   <xsl:param name='therow'/>
> > > <tr>
> > >   <td align="left" valign="middle"><xsl:value-of  
> > > select='$therow/col1'/></td>
> > > ...
> > > </tr>
> > > </xsl:template>
> > > 
> > > </xsl:stylesheet>
> > > 
> > > 
> > > 1) Could you please point me to some good example
> > > of such simple (select) DB report ?
> > > 
> > > 2) How do I pick up that parameter "param1" in XSL ?
> > > 
> > > 3) why do I get a query text on the screen 
> > > instead of the result of the query ?
> > > 
> > > 4) Unless there is something wrong in my sitemap,
> > > I think I can't get anything from SQL transformer
> > > because I am trying to read it from incorrect place:
> > > <xsl:variable name='thedata'
> > > select='/page/content/paging/data'/>
> > > 
> > > Is there a standard place for the output of SQL Transformer?
> > > Or where is it specified ?
> > > 
> > > 5) Is it valid to put queries in XSL files 
> > > or is it a bad practice?  
> > > (as I said, there will be several queries for that screen).
> > > 
> > > Just need to connect it all together  ;-)
> > > 
> > > 
> > > Any help is very appreciated.
> > > 
> > > TIA,
> > > Oleg.
> > > 
> > > 
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > > 
> > > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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