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

Re: Grouping in the FAQ (was Re: Conflicting Node Values)

Subject: Re: Grouping in the FAQ (was Re: Conflicting Node Values)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 26 May 2000 11:50:53 +0100 (BST)
grouping node values in xslt
 
   > Steve Muench writes:
   >  > At least for the Oracle XSLT engine the:
   >  > 
   >  >     generate-id(.) = generate-id(key('tid',.)[1])
   >  > 
   >  > is slightly faster because it doesn't have to produce
   >  > two nodesets to merge and count as does the:
   >  > 
   >  >     count(.|key('tid',.))=1
   >  > 
   >  > approach. The latter is definitely shorter and the
   > 
   > Thats very interesting. Maybe I misinterpret Mike as saying it was
   > faster. 

   I did say the "union" approach might be marginally faster on Saxon, on
   thinking about it again I'm not so sure. I didn't spot that the
   generate-id() approach would only look at the first node in the result of
   key() whereas the union approach looks at all of them. Would need to measure
   to be sure.

   If people are going to start using generate-id() like this, though, I ought
   to think about speeding it up (if possible, without bloating the tree!)



I'm a bit confused as
generate-id(.) = generate-id(key('tid',.)[1])
tests if the current node is the first node returned by the yey
and
generate-id(.) = generate-id(key('tid',.))
is the same due to `take first node in node set'
semantics

but

count(.|key('tid',.))=1

tests that the key only returns one node, and that that is the current
one.

Don't you want

count(.|key('tid',.)[1])=1

which is equivalent to the generate-id tests.


David






 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.