[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

cocoon, sql, & xslt


Subject: cocoon, sql, & xslt
From: "Kari M. Scott" <kmscott@xxxxxxxxxxxxxxxx>
Date: Thu, 13 Jul 2000 10:08:20 -0500 (CDT)

I'm using Cocoon. In my xml file, I query a database and receive the
following results:

+----+------------+-----------------+
| id | name       | project_name    |
+----+------------+-----------------+
|  1 | Customer 1 | Project 1       |
|  2 | Customer 1 | Project 2       |
|  3 | Customer 2 | Project 1       |
+----+------------+-----------------+

In my xsl file, I would like to display something like this:

<B>Customer 1</B>
 <UL>
   <LI>Project 1</LI>
   <LI>Project 2</LI>
 </UL>

<B>Customer 2</B>
 <UL>
   <LI>Project 1</LI>
 </UL>


---------------------------------------------------------
What I don't know how to do is display the customer name once with a list
of projects, so instead I'm getting this:

Customer 1
  Project 1
Customer 1 
  Project 2
Customer 2
  Project 1



Here is a snippet from my xsl file:

  <!-- PROJECTS ===================================================-->
  <xsl:template match="PROJECTS">
      <xsl:apply-templates select="PROROW"/>
  </xsl:template>
  <!-- PROROW ====================================================-->
  <xsl:template match="PROROW">
        <xsl:variable name="id">
          <xsl:value-of select="id"/>
        </xsl:variable>
        <B><xsl:value-of select="name"/></B>
          <UL>
            <LI>
                <a href="projects_results.xml?project={$id}">
                <xsl:value-of select="project_name"/>
                </a>
            </LI>
          </UL>
        <P></P>
  </xsl:template>

---------------------------------------------------------------

Thanks, 
Kari


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

Berbee...putting the E in business


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords