[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Re: Unbounded element grouping/concatenation
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|