Subject: Re: [xsl] Checking alphabetical order From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 24 Sep 2007 11:33:37 -0400 |
Cheers, Wendell
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
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Checking alphabetical ord, Michael Kay | Thread | [xsl] Matching attribute, Buddhi Dananjaya |
[xsl] apply-templates vs value-of i, Jennifer Phan | Date | Re: [xsl] Processing Stylesheet wit, Michael Daniloff |
Month |