cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kari M. Scott" <kmsc...@pandora.binc.net>
Subject sql, xml & forms
Date Tue, 07 Mar 2000 17:54:09 GMT


Hello, 

I'm trying to pass the results of a sql query in an xml file to a variable
in my xsl stylesheet using the xsl:variable element (without using java)
and plugging the variable into a form and I'm not having any luck
discovering the correct syntax. I'm using Cocoon 1.5, Red Hat 6.0, and
MySQL. If someone has any simple xml/forms (sans java for right now) they
could send me, I'd really appreciate it.  Or, here are my xml and xsl
files; what am I doing wrong?  Thanks in advance.

-Kari


_________form.xml______________
<?xml version="1.0" encoding="iso-8859-1"?>

<?cocoon-process type="sql"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="form.xsl" type="text/xsl"?>

<page>
<title>Passing Variables</title>
 <connectiondefs>
  <connection name="foo_connection">
   <driver>org.gjt.mm.mysql.Driver</driver>
   <dburl>jdbc:mysql://localhost/test</dburl>
  </connection>
 </connectiondefs>

 <query connection="foo_connection" doc-element="CATEGORY"
row-element="ROW">
        select child_name from cat_children
 </query>
</page>


---------form.xsl
<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="page">
   <xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
   <html>
    <head>
     <title>
      <xsl:value-of select="title"/>
     </title>
    </head>
    <body bgcolor="#ffffff">
        <form action="results.xml" method="get">
          <BR>Please select a category:</BR>
          <xsl:apply-templates select="CATEGORY"/>
          <P><input type="submit" value="Submit"></P>
        </form>
    </body>
   </html>
  </xsl:template>

  <xsl:template match="CATEGORY">
    <xsl:apply-templates select="ROW">
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="ROW">
    <xsl:variable name="category">
        <xsl:apply-templates/>
    </xsl:variable>
    <INPUT TYPE="RADIO" NAME="category" VALUE="{$category}"/>{$category}
  </xsl:template>

</xsl:stylesheet>



Kari M. Scott
Berbee
5520 Research Park Drive
Madison, WI  53711-5377
kmscott@berbee.com
608.288.3000 ext. 1223
608.298.1223 direct dial
608.288.3037 fax

Berbee...putting the E in business


Mime
View raw message