cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edwin Glaser <ed...@pannenleiter.de>
Subject Re: 2 SQL queries
Date Tue, 14 Mar 2000 20:56:42 GMT
Hello,
 
Simon Dueckert wrote:
> I have a problem processing 2 SQL queries in a row. My problem is that I 
> need to do a query and than take the result from this first query and 
> form another query out of it to perform a second query. 

> Any solutions? 

Yes, and I hope the cocoon community will not kill me.

Keep it simple and stupid, write the logic-sheet in XSL! The rmdms project
(rmdms.sourceforge.net) tries to translate this concept into action.

Your logic-style-sheet may include something like:

<xsl:template name="fetch-list">
  <pl:variable name="list" document="$document">
    select name, id from from articles
  </pl:variable>
  <xsl:apply-templates select="$list" mode="fetch-details"/>
</xsl:template>

<xsl:template match="articles/item" mode="fetch-details">
  <xsl:choose>
    <xsl:when test="@name='foo'">
      <xsl:call-templates name="emit-foo"/>
    </xsl:when>
    <xsl:otherwise>
      <pl:variable name="parts" document="$document">
        select name from from parts where id = <xsl:value-of select="@id"/>
      </pl:variable>
      <xsl:apply-templates select="$parts" mode="emit-part"/>
    </xsl:otherwise>
   </xsl:choose>
</xsl:template>

Rmdms is not usable yet. Database mapping is very rudimentary,
Xalan bindings are not finished and the demos don't separate
application logic and rendering. But it started just one month ago.

Regards, edwin

-- 
Edwin Glaser -- edwin@pannenleiter.de


Mime
View raw message