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

Re: Beware the count method with Muenchian grouping (w

Subject: Re: Beware the count method with Muenchian grouping (was: Testing by counting or positional predicate)
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sun, 14 Jan 2001 11:43:19 +0000
count node muenchian
Hi Daniel,

> Without the filter used in the "match" on the key, the count method
> will give you the nodes that are part of a key (the first one of
> each unique combination), plus all the other nodes matched by the
> XPath that aren't part of the key.

You could get round this by comparing the number of nodes in the
union of the Texture element and the first node returned by the key with
the number of nodes in the set of the first node returned by the key,
rather than always comparing it to 1. If the key returns a node, then
the union will be compared to 1; if it doesn't, it'll be compared with
0 (which will never be true).  So:

//Texture
  [count(key('key-texture', concat(@texture, ':', @u, ':', @v)[1]) =
   count(.|key('key-texture', concat(@texture, ':', @u, ':', @v))[1])]

This is more strictly the equivalent of:

//Texture
  [generate-id() =
   generate-id(key('key-texture', concat(@texture, ':', @u, ':', @v))[1])]

It's just that in most cases, you're assured that the key will return
a node.

Of course the two concat()s, two count()s and the two key()s might
well mean that your assertion still stands: that the generate-id()
method is better in your situation. If you test it, let us know what
you find.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.