"sorted" axis (was: Remove duplicates from a node-set accord
Jarno Elovirta writes: > I'm trying to find a way to remove duplicate nodes from a node-set > according to the content of the nodes, e.g. ignore all duplicate > reference elements whose name attribute is the same. Its not quite the same question, but related. My issue is the processing of a sorted list, and extracting just the different values. My data looks something like this: <cemetery> <stone> <person><name><fnm>Francis d'Arcy Godolphin</fnm><snm>Osborne</snm></name><died><date><day>20</day><mon> 3</mon><yr>1964</yr></date></died></person> <person><name><fnm>Francis d'Arcy Another</fnm><snm>Osborne</snm></name><died><date><day>20</day><mon> 3</mon><yr>1959</yr></date></died></person> <person><name><fnm>Francis d'Arcy TheLast/fnm><snm>Osborne</snm></name><died><date><day>20</day><mon> 3</mon><yr>1964</yr></date></died></person> <stone> .... <person>.... </cemetery> that is to say, a set of <stone>s containing several <person>s who have a <died> date. What I want to end up with is 1959 Another, Francis 1964 Godolphin, Francis TheLast, Francis So, I can process the <person> elements sorted by died/date/yr, and by name/snm. But when I come to the template that matches "person", which receives this sorted node set, I cannot say things like "was the date of the previous person the same as mine", because preceding and following axes refer to the order of the _source_ tree. This is really a question to those developing the XSL spec: is this a reasonable requirement? or am I on the wrong side of the 80/20 divide? is my vague hope for "sorted" axes doomed to disappointment? Can anyone suggest good ways of solving the problem using what we have now? For those who are interested, David Carlisle _did_ find a nice solution for me (data: http://users.ox.ac.uk/~rahtz/xslcourse/data.xml, solution: http://users.ox.ac.uk/~rahtz/xslcourse/ex23.xsl) but it has to use a little brute force and as a result is a trifle slow (it takes 35 minutes to process a 2.5Mbyte input file --- I have only tried it with XT, as it is written using July XSL syntax) Sebastian XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format