Re: Simple XPath question

Subject: Re: Simple XPath question
From: Phil Lanch <phil@xxxxxxxxxxxxxxx>
Date: Mon, 22 Nov 1999 13:31:15 +0000
David Carlisle wrote:
> 
> It doesn't work as
> >  following-sibling::PERSON/@lastname = ./@lastname and
> >  following-sibling::PERSON/@firstname = ./@firstname
> 
> does not force that it is the same following-sibling. ie it selects
> a PERSON if some later person has the same firstname, and a third person
> has the same lastname.  You can make the selection in various ways in
> xslt but I suspect Paul is right that you can't do it in a single
> xpath expression unless you give yourself an extension function that
> (say) returns a string uniquely generated from the firstname and
> lastname attributes of an element node, then you could do
> 
> dpc:bothnames(following-sibling::PERSON)=dpc:bothnames(PERSON)

Using just the built-in functions,
it's possible to get a string uniquely generated from the firstname and
lastname attributes of _one_ element node, e.g.:

concat(string-length(@firstname),' ',concat(@firstname,@lastname))

The problem is that we need your

dpc:bothnames(following-sibling::PERSON)

function to return a list of these uniquely generated strings,
and a list of strings
(as opposed to a list of nodes that happen to be text nodes)
is of course not a valid XPath type.

-- 

cheers

phil

'"having more of a life is one of the earliest
  and subtlest signs of mediocrity"' --- Musil


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread