On Sat, Mar 22, 2008 at 5:43 AM, Kamal <kbhatt(_at_)tt(_dot_)com(_dot_)au>
wrote:
I was in the middle of answering this, and I didn't want my good work to
go to waste, so I thought I would answer again.
Just looking at this:
[not(@label = preceding::*/@label)]
It is comparing the current label is exactly the same as the preceding
labels. For example,
<blah label="A">1</blah>
<blah label="A">2</blah>
<blah label="B">3</blah>
<blah label="B">4</blah>
<blah label="C">5</blah>
This will match on 2, 4, 5. As you can gather, that XPath is pretty much
useless without your dataset being sorted. This is an inefficient way of
grouping values. Your other post about the generate-id is a more
efficient way of doing this. Personally speaking, if you are not worried
too much about efficiency, I recommend sticking with this method. It is
easier to understand and doesn't rely on keys.
Actually, it picks up 1, 3, and 5 and does not matter if the list is
sorted (unless you change the relative order of elements with the same
label). Why? When 1 is selected there are no other nodes (preceding
nodes) with label="A", when 2 is _looked_ at, there is another node
(preceding node) with label="A" (namely 1), so it's excluded.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--