Sorting and Looping within Schematron-Rule
Posted: Mon Mar 05, 2018 2:26 pm
Hello Oxygen Team
I have the following XML structure and I need to validate it with Schematron so that the time periods do not overlap:
So what actually needs to be done is to sort the list descending by start date, loop through the sorted list and check in every iteration whether the end date of the current period is smaller than the start date of the period from the previous iteration. That said, in the second iteration of such a loop the validation logic would check if '2018-04-25' < '2018-04-24' which is false. Thus, we could set a variable "HasOverlappings" to true in this case which is then invoked after the loop within a schematron rule check.
Any idea if this can be done in Schematron and if yes how?
Thank you very much.
Best
Thomas
I have the following XML structure and I need to validate it with Schematron so that the time periods do not overlap:
Code: Select all
<periods>
<period start='2018-02-01' end '2018-02-14' />
<period start='2018-01-01' end '2018-01-22' />
<period start='2018-04-01' end '2018-04-25' />
<period start='2018-03-01' end '2018-01-22' />
<period start='2018-04-24' end '2018-04-28' />
</periods>
Any idea if this can be done in Schematron and if yes how?
Thank you very much.
Best
Thomas