Validating dates in schematron
Posted: Tue Jun 20, 2017 12:36 pm
Hi,
I need to validate the following using schematron: date B must be at 1 day earlier than date A:
Valid XML:
Not valid XML:
I created the following rule comparing the two dates:
but I'm not sure how to say "one day earlier". Do I need to convert the date into number or is there a way to do it directly from the date type in XSLT2?
Thanks in advance,
Ewa
I need to validate the following using schematron: date B must be at 1 day earlier than date A:
Valid XML:
Code: Select all
<dateA>2011-05-11</dateA>
<dateB>2011-05-10</dateB>
Code: Select all
<dateA>2011-05-11</dateA>
<dateB>2011-05-11</dateB>
Code: Select all
<sch:rule context="//dateB">
<sch:assert test="(.) < dateA">ERROR</sch:assert>
</sch:rule>
Thanks in advance,
Ewa