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

Which is less expensive group by or select distinct-v

Subject: Which is less expensive group by or select distinct-values
From: "dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Jul 2016 19:19:23 -0000
 Which is less expensive group by or select  distinct-v
So I have a large document that I need to pull a list of unique values
from a given element. These are taxonomy and term tag values from a 4,000
topic collection of DITA content.

Without knowing how these are implemented, is there something I should be
able to intuit just from the spec? This is some code that I inherited and
it wouldn't have been how I would have attacked the problem:

<xsl:variable name="TermList">
<xsl:value-of select="distinct-values(.//term[not(@keyref)])"
separator=", " />
<data type="topicreport" name="WDTermList">
  <xsl:for-each select="tokenize(normalize-space($TermList), ', ')">
	<xsl:sort select="." />
	<xsl:value-of select="."/>
         <xsl:if test="position() != last()">, </xsl:if>

If this hadn't existed in the stylesheet already, I would have probably
done something like:

<xsl:for-each-group select=".//term[not(@keyref)])" group-by=".">
   <xsl:sort select="current-grouping-key()" />
   <xsl:value-of select="current-grouping-key()"/>
   <xsl:if test="position() != last()">, </xsl:if>

Currently the process (with a bunch of other checks) runs for a very long
time due to the size of the file I'm processing and the number of the
checks. Recently after adding a couple of more checks it keeps requiring
the java heap to be increased as it runs out of memory.

I don't think the above is my major time synch in this process but it is
one class of things that I'm reporting. I think the real processing time
issue is coming from a lot of string analysis/parsing that is occurring.

I'll probably run a physical test in a simple stylesheet with this content
to try and time any significant difference, but I was wondering what your
thoughts would be.

Current Thread


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.
First Name
Last Name
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.