Re: [xsl] Controlling tabular layout of a nodeset

Subject: Re: [xsl] Controlling tabular layout of a nodeset
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Fri, 25 Jul 2003 18:55:59 +0200
John Marshall wrote:

I want to display it as:
> +--------+------------------+
> |property1 - prvalue1       |
> +--------+------------------+
> |user_id1|acct_id1, acct_id2|
+--------+------------------+
> |user_id2|acct_id1 ... |
+--------+------------------+

Seems like a double grouping problem, first by property, then by user_id. You need a composite key for the inner group. Try something like <xsl:key name="property" match="row" use="property"/> <xsl:key name="user_id" match="row" use=" concat(property,':',user_id)"/>

  <xsl:for-each select="row[generate-id() =
       generate-id(key('property',property)[1])">
    <tr>
      <td><xsl:value-of select="property"/></td>
      <td><xsl:value-of select="prvalue"/></td>
    <tr>
    <xsl:for-each select="key('property',property)[
      generate-id()=generate-id(key('user_id',
         concat(property,':',user_id))[1])">
      <tr>
        <td><xsl:value-of select="user_id"/></td>
        <td>
          <xsl:for-each select="key('user-id',
              concat(property,':',user_id))">
          <xsl:if test="position()!=last()>,</xsl:if>
        </td>
     </tr>
    </xsl:for-each>
  </xsl:for-each>
(caution: untested)

J.Pietschmann



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


Current Thread