[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
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
|
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
|