The values are not directly parseable as xs:date or xs:dateTime values, so I
think you’ll have to preprocess them to make proper date strings out of them
and compare them as dates(), e.g.:
local:makeDate(/Test/Date2) gt local:makeDate(/Test/Date1)
Where I leave local:makeDate() as an exercise to the reader (
Cheers,
Eliot
--
Eliot Kimber
http://contrext.com
On 8/16/17, 11:09 AM, "Costello, Roger L. costello(_at_)mitre(_dot_)org"
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Hi Folks,
I have an XML document that contains two elements with values representing
calendar dates, in YYYYMMDD format, e.g.,
<Test>
<Date1>20170816</Date1>
<Date2>20170817</Date2>
</Test>
This is the format that iCalendar (RFC 5545) uses to represent dates.
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?
Is there a counterexample, where <Date2> holds a value representing a
calendar date that is less than (occurs earlier in chronological time) the
calendar date represented in <Data1>, and yet the XPath returns true?
If there is a counterexample, what XPath expression will always work?
/Roger
--~----------------------------------------------------------------
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
--~--