[xsl] Re: Re: Re: Unbounded element grouping/concatenation

Subject: [xsl] Re: Re: Re: Unbounded element grouping/concatenation
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Thu, 11 Dec 2003 21:27:48 +0100
> Raman,
> The recursive algorithm works very well for me with XalanJ2.4.1. It is
> much faster than the variant with generate-id().
> I tested it with a record (type="normal"), which has 200 following
> record (type="continuation").
> With this source xml the recursive transformationtakes 781 ms to run. The
> transformation with generate-id() takes 18687 ms.

FYI, the transformation that uses keys is only slightly slower than the
recursive transformation. With the same source xml it takes 1151ms.

This means that the results of my experiments significantly contradict your
findings. Maybe you didn't use exactly the same transformation or are using
an older version of Xalan?

Here's the transformation, which uses keys:

<xsl:stylesheet version="1.0"

  <xsl:key name="kCont" match="record[@type='continuation']"
                           [@type = 'normal'][1]

  <xsl:output omit-xml-declaration="yes" indent="yes"/>
  <xsl:strip-space elements="*"/>

  <xsl:template match="@* | node()">
      <xsl:apply-templates select="@* | node()"/>

  <xsl:template match="records">
      <xsl:apply-templates select="record[@type = 'normal']" />

  <xsl:template match="record">
      <xsl:apply-templates select="@* | node()" />
         select="key('kCont', generate-id())"/>



Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

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

Current Thread