Re: [xsl] What does this XPath expression mean ?

Subject: Re: [xsl] What does this XPath expression mean ?
From: Kamal <kbhatt@xxxxxxxxx>
Date: Sun, 23 Mar 2008 12:05:20 +1100
Kevin Grover wrote:
On Sat, Mar 22, 2008 at 5:43 AM, Kamal <kbhatt@xxxxxxxxx> 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.
Serves me right for answering so late at night :). Apologies, you are right about the selection.When I was talking about sorting, I meant sorting against label.

Current Thread