xsl-list
[Top] [All Lists]

Re: XSL:key and Column grouping

2005-02-01 13:42:11
Hi David,

Yes, you're almost there. In order to use key() as flexibly as you need to, you have to "back out" a bit.

Try modifying this bit of code:

<xsl:for-each select="key('map', mapunits/maps)[position() mod 3 = 1]">
  <tr valign="top" style="width:100%">
    <xsl:apply-templates select=".|following-sibling::maps[position() &lt;
3]"/>
  </tr>
</xsl:for-each>

to read something like:

<xsl:variable name="key-value" select="mapunits/maps"/>
<xsl:for-each select="key('map', $key-value)">
  <xsl:if select="position() mod 3 = 1">
    <xsl:variable name="pos" select="position()"/>
    <tr valign="top" style="width:100%">
      <xsl:apply-templates select=". |
         key('map', $key-value)[$pos+1] |
         key('map', $key-value)[$pos+2]"/>
      <!-- and maybe you'll want code here to provide
           blank cells when you don't have exact multiples of three -->
    </tr>
  </xsl:if>
</xsl:for-each>

I hope it's more or less self-explanatory....

Cheers,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--~------------------------------------------------------------------
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>