cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject Re: Linking SQL Transformer and XSL Transformer
Date Thu, 22 Jul 2004 12:02:42 GMT
Matt

Its still not clear from the small fragments you have
pasted, just where you are going wrong - try this type of
approach and then work your way backwards:

page-sql.xml

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0"> 
    <sql:query name="themes">
    <!-- here comes the SQL statement - yours need to be different -->  
    SELECT ThemeID, ThemeGo FROM Theme    
    </sql:query>
  </sql:execute-query>
</page>

and in the sitemap:

   <map:match pattern="page-sql">
     <map:generate src="page-sql.xml"/>
     <!-- === SQL Connector ==== -->       
     <map:transform type="sql">
       <map:parameter name="use-connection" value="your_db_user"/>
       <map:parameter name="show-nr-of-rows" value="true"/> 
       <map:parameter name="clob-encoding" value="UTF-8"/> 
     </map:transform> 
     <map:serialize type="xml"/>
   </map:match>

This *should* you give a series of rows, with data from 
your database like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<page>
 <rowset xmlns="http://apache.org/cocoon/SQL/2.0" xmlns:sql="http://apache.org/cocoon/SQL/2.0"
nrofrows="8" name="themes">
<row>
<themeid>blah</themeid>
<themego>blah</themego>
</row>
</rowset>
</page>

Test this and check everything is working, before
starting to add in the other steps - one-by-one....

Derek


>>> mattaios@pasteur.fr 2004/07/22 01:44:48 PM >>>



derek

here's the sample of the xml file:

<requete id='1'>
<name>Collection</name>
<attributes>
<attribute><valuetitle>id_collection</valuetitle></attribute>
</attributes>
<tables>
<table>collection</table>
</tables>
</requete>

and here's a (simplified) sample from the transformation template:

<xsl:template name="reqpred">
       	
	SELECT
	  <xsl:for-each select= "attributes/attribute">
	   <xsl:value-of select="valuetitle"/>
	   </xsl:for-each>
	
	FROM
	  <xsl:for-each select="tables/table">
	  <xsl:value-of select="."/>
            </xsl:for-each>
	
           etc..

</xsl:template>

With this I manage to generate the following :

  SELECT libelle_collection  FROM  collection

What I want is to be able to execute this and display the result 
through my chained transformers.

I hope I'm clear enough for you to figure out what I want do do
If not, please ask for more samples.

and be sure I very happy that you help me

Matt

Le 22 juil. 04, à 11:44, Derek Hohls a écrit :

> Matt
>
> I think you will have to post a sample of the input
> XML file and the reqparam.xsl file that is supposed
> to do the transform, and we can see why its not
> working the way it should...
>
> Derek
>
>>>> mattaios@pasteur.fr 2004/07/22 11:37:03 AM >>>
> Hello Derek
>
>
> Le 22 juil. 04, à 11:27, Derek Hohls a écrit :
>
>> Matt
>>
>> When you say "The requests are correctly generated"
>> do you mean the SQL is in the right XML wrappers and
>> format to be processed by the SQL transformer...
>
> No, that's precisely that I can't have the wrappers appear
> that's why I wanted to generate them with <xsl:element...>
>
> The query itself is correct when tested directly on the database
>
> How shall I make the request visible for the SQL Transformer
> after the first XSL Transformation?
>
> I thank you for being so helpful!!
>
> Matt
>
>
>>>>> mattaios@pasteur.fr 2004/07/22 10:28:52 AM >>>
>> Hello!
>>
>> Thanks for your answer.
>>
>> Here's my code :
>> (in reqparam.xsl)
>>
>> <!-- i fetch the xml data necessary to generate the request-->
>> <xsl:for-each select="/requetes/requetesparam/requete[@id= $noreq]">
>>
>>             <sql:execute-query>
>>          <sql:query>
>>
>> <!-- I call the template that generates the request -->
>>         <xsl:call-template name="reqpred"/>
>>
>> </sql:query>
>>           </sql:execute-query>
>>
>>       </xsl:for-each>
>>
>> and here's my pipeline:
>>
>> <map:match pattern="reqparam">
>>         <map:generate src="requetes.xml" />
>>
>>         <map:transform src="reqparam.xsl"/>
>>
>>          <map:transform type="sql">
>>         <map:parameter name="use-connection" value="syb"/>
>>         <map:parameter name="show-nr-of-rows" value="true"/>
>>         <map:parameter name="clob-encoding" value="UTF-8"/>
>>         </map:transform>
>>        <map:transform src="stylesheets/sql2html.xsl"/>
>>         <map:serialize/>
>>        </map:match>
>>
>> The requests are correctly generated, but i can't have them executed,
>> (so i can't display the data their execution must retrieve).
>>
>> Is anything wrong?
>>
>> Thank you!!!
>>
>> Matt
>>
>> PS : Is it possible to use the ESQL taglib in a XSL stylesheet?
>>          I've read that esql was only for XSPs...
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>> -- 
>> This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>> MailScanner thanks transtec Computers for their support.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
>> For additional commands, e-mail: users-help@cocoon.apache.org 
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> For additional commands, e-mail: users-help@cocoon.apache.org 
>
>
>
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> MailScanner thanks transtec Computers for their support.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> For additional commands, e-mail: users-help@cocoon.apache.org 
>
>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message