xsl-list
[Top] [All Lists]

Re: Extracting the grouping from a flat structure

2004-12-06 06:47:23
On Monday 06 December 2004 00:34, Peter Wyngaard wrote:

<xsl:for-each select='//TABLE[(_at_)class="results"]/TR[TH]'>
  <header>
   <xsl:attribute name=...>...</xsl:attribute>
   <xsl:variable name='thisHeader'
select='generate-id(.)'/> <xsl:for-each
select='following-sibling::TR[$thisHeader=generate-id(pre
ceding- sibling::TR[TH][1])]'>
    <row>
     ...
    </row>
   </xsl:for-each>
  </header>
</xsl:for-each>

Hi Peter,

This looks to me like a pretty standard solution to this 
problem although its clearly inefficient for larger data 
sets.

As an alternative I would be tempted to try a two pass 
approach, the first to collect the position() of all your 
headers in a variable and the second to chop and process a 
nodeset of all the rows using a recursive template and the 
position() data. This would exchange searching for nodeset 
manipulation so your milage will vary on different 
processors.

Kev.

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