cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: Multiple Transformations
Date Sat, 23 Sep 2000 21:42:45 GMT
On Sat, 23 Sep 2000, Benjamin Dixon wrote:

> Wow! The cahcing is a major improvement (at least for 60 seconds :>) but
> I'm still mystified about how I should implement this stuff. I think our
> ideas are along the same lines, I want to provide a certain set of tags to
> other developers so that they never have to worry about logicsheets etc,
> all the need to know about is XSL and the tags at their disposal. I don't
> know how to accomplish that AND use esql. I took the XSL step out of my

that's easy. your logicsheet will perhaps have a template like so:

<xsl:template match="goheels:articles">
 <esql:execute-query>
  ...
  <esql:query>select * from article_table 
   where subject = '<xsl:value-of select="subject"/>'</esql:query>
  <esql:results>
   <article>
    <title><esql:get-string column="title"/></title>
    <body><esql:get-xml column="body"/></body>
   </article>
  </esql:results>
 </esql:execute-query>
</xsl:template>

nothing could be simpler.

> pages and I noticed that the XSP/esql combo always returns an HTML
> doctype. I suspect that is the source of all my problems. But if I want to
> dynamically select things out of a database, process some of them (format
> dates, phone numbers, etc) BEFORE they arerive at the stylesheet, I have
> no clue how to go about it. I wish there were examples of more complex
> setups lying around.

it's returning an HTML doctype since that what cocoon defaults to. that
is not the source of your problems because the document is still in XML
form when it's passed from processor to processor. you can probably do
your postprocessing of your database results in your logicsheet:

<xsl:template match="mytag:foo">
 <esql:execute-query>
  ...
  <esql:results>
   <my-date><esql:get-date format="MMM d, yyyy" column="my_date"/></my-date>
   <my-phone>
    <xsp:expr><esql:get-string column="phone"/>.substring(0,3)</xsp:expr>-
    <xsp:expr><esql:get-string column="phone"/>.substring(4)</xsp:expr>
   </my-phone>
  </esql:results>
 </esql:execute-query>
</xsl:template>

- donald


Mime
View raw message