Re: [xsl] Set difference in xsl:number/@count, xsl:key/@match

Subject: Re: [xsl] Set difference in xsl:number/@count, xsl:key/@match
From: Deborah Pickett <debbiep-list-xsl@xxxxxxxxxx>
Date: Wed, 21 Mar 2007 21:58:06 +1100
Hi Ken,

G. Ken Holman wrote:
  <xsl:number count="*[contains(@class, ' figure ')]
              except *[contains(@class, ' flowchart ')]"/>
only set difference doesn't work in xsl:number/@count, even in XSLT 2.0.
Have you tried:
count="*[contains(@class,' figure ') and not(contains(@class,' flowchart '))]"

Yes, that would do the same as a set difference (thanks, and duh on my part), but it fails the encapsulation requirement which you snipped from my original message: I don't know how many "and not()"s there are going to be ahead of time, so constructing the pattern that way is difficult.


(It may seem like an artificial requirement, but it makes perfect sense in the context of DITA, with its `-la-carte approach to specializations. I could explain it, but I'd bore you and everyone else.) That's why I was hoping for a key-based solution, where the encapsulation behaviour is spot on, but it doesn't give me set difference (or so I think).

I suppose I could generate the count pattern dynamically, but that feels even dirtier to me.

(though I don't know how you plan to do your numbering if one construct has both properties).

(I've got a similar <xsl:number> for just flowcharts, and for extensions thereof. Turtles all the way down, and all that.)


Current Thread