[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Checking alphabetical order
Hi,
I would like to compare elements and determine if any element is out of alphabetical order, for XPath 1.0. For example, <Elements> <Element>AAA</Element> <Element>BBB</Element> <Element>CCCC</Element> </Element>AAAAAA</Element> </Elements> I would like this to register that the final element is out of sequence. I thought about doing this with preceding-sibling, unfortunately, it turns out that doesn't work for strings. If they are numbers, I can do it. For example, if I had numbers, such as, <Elements> <Element>1</Element> <Element>2</Element> <Element>3</Element> </Element>1</Element> </Elements> And I used: Elements/Element[. < preceding-sibling::node()] I would get the last element. I suspect I can do this with a template (manually compare the current node to the preceding-sibling), but I was wondering if there was a simple way of doing this. If there isn't, can you please keep the non simple solution (ie the one where you have to create a template to compare two strings) to yourself as I would like to have a stab at it myself. Thanks. -- Kamal Bhatt
|
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
|