Re: Last tango in Paris
Brought to you by:
bs_php,
nigelswinson
From: Nigel S. <nig...@us...> - 2002-05-30 23:56:00
|
Peter brought this bug up a while back, but we'd forgotten about it. It has been fixed now. The brief story is that double predicates like /*[last()][@Attr='X'] will now work. If you want more background then you can read on some of Peter and my discussion from this evening... I think it is unlikely that this bug affects you. I think most XPath users only use one [] not two or more [][], but thought I should post to the list just in case it does. :o) Nigel > On Thursday 30 May 2002 20:41, Nigel Swinson wrote: > > > > > Also, it looks like the double predicate problem (my 'last tango > > > in Paris' example) is still outstanding - is that correct? > > > > I had to go and research this but I what I found was going to > > http://www.zvon.org:9001/saxon/cgi-bin/XLab/XML/extras.html?stylesh > >eetFile=X SLT/xpath.xslt (Link doesn't seem to be working right just > > now) that //*[last()] could return more than one node, so it seemed > > that we were implementing last() right. > > > > There does however seem to be a second issue todo with > > /nodetest[][] double predicates, which DOES NOT seem to be working. > > I don't know if it's meant to though. Is it? If it is then it > > seems we still have a bug... > > > > Can you confirm? > > yes, these are 2 two different things. The problem is not with last > but with >1 predicates. Look at say the company structure xml in the > useCases testbench. If you do //employee[last()] it will fetch the > last employee node in each parent (dept), 5 of them in this case, > which is correct. If you do //employee[@gender='m'], it will fetch > all the male employees. But if you try and combine the 2, i.e. a > 2-stage process: fetch the male employees and then give me the last > one //employee[@gender='m'][last()] it brings an error that it can't > find a gender function. > The example in the xpath spec is para[@type="warning"][5] > In my tango example, you can fetch all the tangos in Paris, and all > the last tangos, but not the two together. > > These positional ones are not too difficult to work around, as you can > simply read all the first predicate into an array and then use php to > fish out the one you want, but at least in principle, you can have > any predicate and any number of predicates, tho in practice I doubt > whether anyone would have much use for this. > > I don't think this is a bug btw, I don't think it was ever coded :-) > |