cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Konovalov <>
Subject Simple DB report
Date Tue, 08 Nov 2005 23:28:07 GMT

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 type="xslt"
      <map:parameter name="use-request-parameters"
    <map:serialize type="html"/>

Here is a piece from the query file:
<xsl:param name='param1'/>
  <sql:query name="cust_data">
    SELECT  col1, col2, col3
    FROM  cust_table
    WHERE  cust_id = <sql:substitute-value sql:name="param1"/>

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'
<xsl:param name='param1'/>

<xsl:variable name='thedata'

<xsl:template match="/">
		<title>Customer Data popup</title>
			<xsl:apply-templates />
				   SELECT  col1, col2, col3
    FROM  cust_table
    WHERE  cust_id = <sql:substitute-value sql:name="param1"/>	

<xsl:template name='page-main'> 
	<form name="myformname" id="myform" method="post"
    <xsl:for-each select='$thedata/row'>
      <xsl:call-template name='row'>
	<xsl:with-param name='therow' select='.'/>

<xsl:template name="row">
	<xsl:param name='therow'/>
  <td align="left" valign="middle"><xsl:value-of  


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'

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.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message