You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stefan Lettmayer <sl...@twix.sharkman5.2y.net> on 2001/04/11 16:37:17 UTC

[C2]: Problem with applying a stylesheet with esql tags

Hi!!

I have a xml file with a tag named buttonbar. Then a stylesheet should apply several esql tags to perform some queries and make an html page.

In the sitemap i have:
<map:match pattern="**.test">
  <map:generate type="serverpages" src="test/{1}.xml"/>
  <map:transform src="test/test.xsl"/>
  <map:serialize type="html"/>
</map:match>

The test/test.xml file:
<?xml version="1.0"?>
<page>
  <buttonbar />
  <p>
    fkhsajkdfhjkasdh fjhasjfh jashf jashf
  </p>
</page>

And my test/test.xsl looks like this:
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsp="http://apache.org/xsp"
  xmlns:esql="http://apache.org/cocoon/SQL/v2">

  <xsl:template match="page">
   <html>
    <body>
     <xsl:apply-templates />
    </body>
   </html>
  </xsl:template>

  <xsl:template match="buttonbar">
   <esql:connection>
    <esql:driver>org.postgresql.Driver</esql:driver>
    <esql:dburl>jdbc:postgresql://localhost/pmi_web</esql:dburl>
    <esql:username>*****</esql:username>
    <esql:password>*****</esql:password>
    <esql:execute-query>
     <esql:query>select * from test</esql:query>
     <esql:results>
      <esql:row-results>
       <h2><esql:get-string column="langcode" /> ist <esql:get-string column="name" /></h2>
      </esql:row-results>
     </esql:results>
    </esql:execute-query>
   </esql:connection>
  </xsl:template>

  <xsl:template match="p">
   <p>
    <xsl:apply-templates />
   </p>
  </xsl:template>

</xsl:stylesheet>



What is wrong??
Or is this impossible??

Thanks in advance and sorry for my poor english


-- 
Stefan Lettmayer
Web: http://sharkman5.2y.net/
ICQ: 67167870

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: [C2]: Problem with applying a stylesheet with esql tags

Posted by Stefan Lettmayer <sl...@twix.sharkman5.2y.net>.
But is there no way to declare the xsp page in the stylesheet, so that i need not make an xsp page from the xml document?
for example i have a normal xsl stylesheet which applies some esql tags and thenn this page gets compiled so that i need not change my xml document to a xsp page.

Stefan Lettmayer

On Wed, Apr 11, 2001 at 03:48:12PM -0400, Donald Ball wrote:
> On Wed, 11 Apr 2001, Stefan Lettmayer wrote:
> 
> > I have a xml file with a tag named buttonbar. Then a stylesheet should
> > apply several esql tags to perform some queries and make an html page.
> 
> this is a good paradigm to follow, but you need to shuffle things around a
> little - the stylesheet that adds the esql tags needs to come before the
> serverpages generation step, whereas your stylesheet mixes up the html
> final style tags and the esql logic tags. what you do is create a
> logicsheet which transforms an element like this:
> 
> <mine:get-something/>
> 
> into the esql tags that perform that task:
> 
> <esql:connection>
>   ....
> </esql:connection>
> 
> note again - this is _not_ where the html gets put in, this is just logic.
> your logicsheet should (probably) copy all other xml nodes intact. then
> you need to register your logicsheet in cocoon.xconf:
> 
> <builtin-logicsheet>
>  <parameter name="prefix" value="mine"/>
>  <parameter name="uri" value="http://example.com/xml/mine/1.0"/>
>  <parameter name="href" value="context://logic/mine.xsl"/>
> </builtin-logicsheet>
> 
> and then, if your xsp page declared the 'mine' namespace, the logicsheet
> will be automatically applied. i'm working on a tutorial for this since i
> personally just struggled through doing my first c2 site complete with xsp
> and such. :)
> 
> - donald
> 
> 
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
> 

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: [C2]: Problem with applying a stylesheet with esql tags

Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 11 Apr 2001, Stefan Lettmayer wrote:

> I have a xml file with a tag named buttonbar. Then a stylesheet should
> apply several esql tags to perform some queries and make an html page.

this is a good paradigm to follow, but you need to shuffle things around a
little - the stylesheet that adds the esql tags needs to come before the
serverpages generation step, whereas your stylesheet mixes up the html
final style tags and the esql logic tags. what you do is create a
logicsheet which transforms an element like this:

<mine:get-something/>

into the esql tags that perform that task:

<esql:connection>
  ....
</esql:connection>

note again - this is _not_ where the html gets put in, this is just logic.
your logicsheet should (probably) copy all other xml nodes intact. then
you need to register your logicsheet in cocoon.xconf:

<builtin-logicsheet>
 <parameter name="prefix" value="mine"/>
 <parameter name="uri" value="http://example.com/xml/mine/1.0"/>
 <parameter name="href" value="context://logic/mine.xsl"/>
</builtin-logicsheet>

and then, if your xsp page declared the 'mine' namespace, the logicsheet
will be automatically applied. i'm working on a tutorial for this since i
personally just struggled through doing my first c2 site complete with xsp
and such. :)

- donald


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>