Hi folks,

I'm be experimenting with passing in parameters to SQLTransformer and 
not having much luck. First, I tried this:

    <map:match pattern="paramsql">
      <map:generate src="docs/samples/sql/sqltest.xml"/>
      <map:transform type="sql">
        <map:parameter name="use-connection" value="test"/>
        <map:parameter name="id" value="1"/>
      </map:transform>
      <map:transform src="stylesheets/simple-sql2html.xsl"/>
      <map:serialize/>
    </map:match>

My sqltest.xml file looks like this:

<?xml version="1.0"?>

<page xmlns:sql="http://apache.org/cocoon/SQL/2.0";>

  <title>Hello</title>
  <content>
   <para>This is my first Cocoon2 page filled with sql data!</para>

   <execute-query xmlns="http://apache.org/cocoon/SQL/2.0";>
    <query>
         select id,name from department_table where id = 
<substitute-value sql:name="id"/>
    </query>
   </execute-query>

  </content>
</page>


And it works just fine.

Now, what I really want to do is pass in the "id" parameter via a 
request parameter: http://localhost:8080/cocoon/paramsql?id=1.

So I tried this:

    <map:match pattern="paramsql">
     <map:act type="request">
      <map:parameter name="parameters" value="true"/>
      <map:generate src="docs/samples/sql/sqltest.xml"/>
      <map:transform type="sql">
        <map:parameter name="use-connection" value="test"/>
      </map:transform>
      <map:transform src="stylesheets/simple-sql2html.xsl"/>
     </map:act>
     <map:serialize/>
    </map:match>


But the "id" parameter is always missing when it gets to the 
SQLTransformer (so it throws up at the replaceCharWithString line). My 
understanding of the RequestParamAction is that it will post all the 
request parameters to the pipeline. Wouldn't this make it the same as if 
I explicitly declared the "id" parameter in the sitemap?

Thanks in advance.

Lajos


---------------------------------------------------------------------
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]>

Reply via email to