[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Re: Unbounded element grouping/concatenation

Subject: Re: Re: Re: Unbounded element grouping/concatenation
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Thu, 11 Dec 2003 21:27:48 +0100
element grouping means
> Raman,
>
> The recursive algorithm works very well for me with XalanJ2.4.1. It is
also
> much faster than the variant with generate-id().
>
> I tested it with a record (type="normal"), which has 200 following
siblings
> 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"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:key name="kCont" match="record[@type='continuation']"
   use="generate-id(preceding-sibling::record
                           [@type = 'normal'][1]
                    )"/>

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

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

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

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

</xsl:stylesheet>


=====
Cheers,

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




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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.