This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Beware the count method with Muenchian grouping (was: Testing by counting or positional predicate)


Sorry, error in the original posting - that should be:

Daniel Bowen wrote:
...
>
>
> So that's why you need the same filter as used in the "match" on the key to
> be there if you do it the count way:
> <xsl:variable
>   name="primary-textures"
>   select="//Texture
>         [0=count(preceding-sibling::Texture[1])]
>         [1=count(.|key('key-texture', concat(@texture, ':', @u, ':',
> @v))[1])]"
> />
>
> 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.
>
Yes. Interesting. I didn't think through the implications of having a
predicate on the match attribute of your xsl:key.

At the risk of stating the obvious, have you tried

<xsl:key
  name="all-texture"
  match="Texture"
  use="concat(@texture, ':', @u, ':', @v)" />
<xsl:variable
  name="primary-textures"
  select="//Texture[0=count(preceding-sibling::Texture[1])][count(. |
(key('all-texture', concat(@texture, ':', @u, ':', @v))[1]) = 1]"
  />

- I'd really be interested in the result.

Francis.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]