xsl-list
[Top] [All Lists]

RE: Summarising XML datasets

2004-12-21 01:16:13
Hi,

I have a problem formatting some XML I am receiving from a 3rd party
application that I cannot alter.

The application is querying a database that has a table 
called photo and a
table called photosubject, there is a one to many 
relationship between photo
and photosubject.

snip

What I want to do if possible is to render the information 
using xslt as:

HouseID  |  House  |  Description | Subjects
===========================================
1        |  House  |  House 1     | X, Y, Z

XSLT 2.0 solution

  <tbody>
    <xsl:for-each-group select="results/photograph" group-by="id">
      <tr>
        <td>
          <xsl:value-of select="id"/>
        </td>
        <td>
          <xsl:value-of select="name"/>
        </td>
        <td>
          <xsl:value-of select="description"/>
        </td>
        <td>
          <xsl:value-of select="current-group()/subject" separator=", "/>
        </td>
      </tr>
    </xsl:for-each-group>
  </tbody>

See <http://www.jenitennison.com/xslt/grouping/> how to achieve this using XSLT 
1.0 and the Muenchian Method.

Cheers,

Jarno

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>