Subject: Re: [xsl] What does this XPath expression mean ? From: "Kevin Grover" <kevin@xxxxxxxxxxxxxxx> Date: Sat, 22 Mar 2008 11:39:06 -0700 |
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] What does this XPath expr, Kamal | Thread | Re: [xsl] What does this XPath expr, Kamal |
Re: [xsl] Style sheet to perform na, David Carlisle | Date | Re: [xsl] XSLT processor for Mac OS, Andrew Welch |
Month |