[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Checking alphabetical order

Subject: Checking alphabetical order
From: Kamal Bhatt <kbhatt@xxxxxxxxx>
Date: Mon, 24 Sep 2007 08:16:39 +1000
 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[. &lt; 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.