Subject: Re: [xsl] 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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Beware the count method w, Daniel Bowen | Thread | Re: [xsl] Beware the count method w, Daniel Bowen |
Re: [xsl] Xalan C++ and string lite, David_N_Bertoni | Date | Re: [xsl] Displaying images with IE, Mark Andrews |
Month |