You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ard Schrijvers <a....@hippo.nl> on 2006/05/01 12:07:24 UTC

RE: modular DatabaseAction and database description file

I cannot really help with map:action and xsp's, because I never use them, but if you're heading for a little bit more complex things and database queries, try to take a look at how things are made persistent with BrickCms (it is not a cms, but an example): http://wiki.apache.org/cocoon/BricksCms and 
http://www.cocoongt.org/binaries/bricks-cms-overview.pdf.

Your maintainance will be way easier and your application much cleaner.

Regards Ard

-- 

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
a.schrijvers@hippo.nl / http://www.hippo.nl
-------------------------------------------------------------- 


> 
> Hi all, I am trying to run a query.
> 
> sitemap.xml:
>   <map:action-sets>
>     <map:action-set name="process">
>       <map:act type="req-params">
>          <map:parameter name="parameters" value="qry-node node.id"/>
>          <map:act type="mod-db-qry" mode="one">
>             <map:parameter name="table-set" value="querytableset"/>
>             <map:parameter name="dummy" value="123"/>
>          </map:act>
>       </map:act>
>     </map:action-set>
>   </map:action-sets>
> 
>   ...
> 
>   <map:pipelines>
>     <map:pipeline>
>       <map:match pattern="*.html">
>         <map:act set="process">
>           <map:parameter name="use-request-parameters" value="true" />
>         </map:act>
>         <map:aggregate element="site">
>            <map:part src="cocoon:/menu"/>
>            <map:part src="cocoon:/body/{1}"/>
>         </map:aggregate>
>         <map:transform src="context://stylesheets/site-to-xhtml.xsl"/>
>         <map:serialize type="html"/>
>       </map:match>
>     </map:pipeline>
>   </map:pipelines>
> 
> database description file:
> 
>   <table name="querytable">
>     <queries>
>        <query mode="others">select id from node where id=?</query>
>     </queries>
>     <keys>
>         <key name="id"          type="int" autoincrement="true">
>            <mode name="auto"    type="autoincr"/>
>         </key>
>     </keys>
>   </table>
> 
> I don't get any errors, but as well the XSP {1} does not get 
> any attributes. In a future version I would like to call SQL 
> stored procedures. Can anyone help, with may be a description 
> or a DTD of the database description file? Thank you, mare..at.web.de
> 
> 
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
> 
> 
> ---------------------------------------------------------------------
> 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


SQLTransformer Help

Posted by Andre Fiedler <an...@gmx.de>.
Hi everybody,

I am creating a cocoon application talking to a database, extracting  
the basic information via SQLTransformer and let it be displayed. So  
far so good .. almost everything is fine, instead of one thing. After  
database communication creates the XML-file in (A) my XSLT (B) should  
transform it and give the output in a table .. But even after  
successfully calling the correct template and print some nonsens for  
debugging purposes I am still not able to address the sql createt  
elements in the XML-file one level deeper ... :-/ u know what I  
meen ? let me show you:

(A) generated XML File
--------------------------------

<speiseplan xmlns:xi="http://www.w3.org/2001/XInclude">
	<tage nrofrows="5" name="tage" xmlns:sql="http://apache.org/cocoon/ 
SQL/2.0" xmlns="http://apache.org/cocoon/SQL/2.0">
		<tag>
			<tag_id>1</tag_id>
			<tag_name>Montag</tag_name>
		</tag>
		<tag>
			<tag_id>2</tag_id>
			<tag_name>Dienstag</tag_name>
		</tag>
		<tag>
			<tag_id>3</tag_id>
			<tag_name>Mittwoch</tag_name>
		</tag>
		<tag>
			<tag_id>4</tag_id>
			<tag_name>Donnerstag</tag_name>
		</tag>
		<tag>
			<tag_id>5</tag_id>
			<tag_name>Freitag</tag_name>
		</tag>
	</tage>
	<content>
		<rowset nrofrows="3" xmlns:sql="http://apache.org/cocoon/SQL/2.0"  
xmlns="http://apache.org/cocoon/SQL/2.0">
			<row>
				<essen_titel>Essen 1</essen_titel>
				<essen_beschreibung>Senfeier mit Backkartoffeln und  
Schwarzwurzeln</essen_beschreibung>
				<essen_preis>2.5</essen_preis>
			</row>
			<row>
				<essen_titel>Essen 2</essen_titel>
				<essen_beschreibung>Tomatensuppe, dazu Basilikum. Croutons und  
Gew&uuml;rze der Provence</essen_beschreibung>
				<essen_preis>2.99</essen_preis>	
			</row>
			<row>
				<essen_titel>Bio-Essen</essen_titel>
				<essen_beschreibung>Spaghetti Bolognese mit frischem Parmesan</ 
essen_beschreibung>
				<essen_preis>3.8</essen_preis>
			</row>
		</rowset>	
	</content>	
</speiseplan>


(B) XSLT extract
----------------------
...
<xsl:template name="tag" match="sql:rowset">
        <br/> <br/>
         <p class="p">
             <xsl:value-of select="$var"/>
         </p>
         <br/> <br/>
         <table width="600" class="content_table" cellpadding="5"  
cellspacing="0">
             <tr>
                 <td class="content_table_top" width="20%">Titel</td>
                 <td class="content_table_top"  
width="60%">Beschreibung</td>
                 <td class="content_table_top" width="20%">Preis in  
EURO</td>
             </tr>
          <xsl:call-template name="essen"/>
         </table>
  </xsl:template>


   <xsl:template name="essen" match="rowset/sql:row">
         <tr>
             <td class="content_table_td" width="20%">b<xsl:value-of  
select="sql:essen_titel"/></td>
             <td class="content_table_td" width="60%">b<xsl:value-of  
select="sql:essen_beschreibung"/></td>
             <td class="content_table_td" width="20%">b<xsl:value-of  
select="sql:essen_preis"/></td>
         </tr>
   </xsl:template>
...


(C) generated HTML extract
--------------------------------------
...
<table cellspacing="0" cellpadding="5" class="content_table"  
width="600">
<tr>
<td width="20%" class="content_table_top">Titel</td><td width="60%"  
class="content_table_top">Beschreibung</td><td width="20%"  
class="content_table_top">Preis in EURO</td>
</tr>
<tr>
<td width="20%" class="content_table_td">b</td><td width="60%"  
class="content_table_td">b</td><td width="20%"  
class="content_table_td">b</td>
</tr>
</table>
	
Essen 1Senfeier mit Backkartoffeln und Schwarzwurzeln2.5Essen  
2Tomatensuppe, dazu Basilikum. Croutons und Gew&uuml;rze der  
Provence2.99Bio-EssenSpaghetti Bolognese mit frischem Parmesan3.8	


(D)
-----
Obvisously I want the Entries "Essen 1..." appear in the table and  
not afterwards .. :-( and do undergo that mechanism as much as row- 
elements appear, not only once as it is now .. (rember the rows of  
"b" in (A))

Do you know an answer to that? currently it has driving me crazy for  
5 hours ..

thanks and greetings

Andre


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