You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Adrian Geissel <ag...@zenark.com> on 2001/06/06 17:43:34 UTC

Mixing XSL and XSP in a single stylesheet

Hi,

I'm trying to write a data abstraction layer to retrieve records from an SQL database (using ESQL) and then to format these into an XML fragment (using XSLT) for onward transformation.

It appears that the xsl: namespace elements are not being executed - can I do this in a single step, or do I need to tease it apart into two transformation steps? I've included the important code fragment below, with comments following the xsl statements that do not work.

Any help will be greatly appreciated
Cheers
Adrian

--- Code Fragment ---
<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<?xml-stylesheet type="text/xsl" href="zdam/zdam2html.xsl"?>
<?cocoon-process type="xslt"?>

<?cocoon-format type="text/xsl"?>
<?cocoon-content type="text/plain"?>

<xsp:page
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:esql="http://apache.org/cocoon/SQL/v2"
  xmlns:zdam="zenark.com/zdam"
>
<zdam:data>

<esql:connection>
  <esql:driver>postgresql.Driver</esql:driver>
  <esql:dburl>jdbc:postgresql://193.120.120.11/zdam_test</esql:dburl>
  <esql:username>sql</esql:username>
  <esql:password>garfield</esql:password>
  <esql:execute-query>
    <esql:query>
        SELECT id,name,description,category,author,rev_id,status 
         FROM latest_revisions
    </esql:query>
    <esql:results>
      <esql:row-results>
        <xsl:variable name="_REVID"><esql:get-string column="rev_id"/></xsl:variable>
        <xsl:variable name="_STATUS"><esql:get-string column="status"/></xsl:variable>
        <zdam:asset id="." name="." author="." category="."> <!-- Works -->
         <xsl:attribute name="id"><esql:get-int column="id"/></xsl:attribute> <!-- Fails -->
         <xsl:attribute name="name"><esql:get-string column="name"/></xsl:attribute>  <!-- Fails -->
         <xsl:attribute name="author"><esql:get-string column="author"/></xsl:attribute> <!-- Fails -->
         <xsl:attribute name="category"><esql:get-string column="category"/></xsl:attribute> <!-- Fails -->
         <zdam:description><esql:get-string column="description"/></zdam:description> <!-- Works -->
      </esql:row-results>
    </esql:results>
  </esql:execute-query>
</esql:connection>

</zdam:data>
</xsp:page>

--- End Code Fragment ---