xsl-list
[Top] [All Lists]

Re: [xsl] XPath string comparison of two strings representing calendar dates ... any counterexamples?

2017-08-16 11:26:42
On 16 August 2017 at 18:09, Costello, Roger L. costello(_at_)mitre(_dot_)org <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:


I wish to test to see if the calendar date represented in <Date2> is
greater than (occurs later in chronological time) the calendar date
represented in <Date1>. Here's an XPath expression to do the test:

/Test/Date2 gt /Test/Date1

In this case, the XPath returns true.

Note that I am doing mere string comparison. I am comparing the string
'20170817' against the string '20170816'.

Will the XPath always work?


No. Once the year reaches 5 digits, 2017 will be greater and later than
10010 or so.

Well, you wrote "always"!

-W
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>