Imagine a truck delivery schedule. Suppose xml is:
...
<schedule>
<leg>
<depart>08:00</depart>
</leg>
<leg>
<arrive>08:45</arrive>
<depart>10:00</depart>
</leg>
<leg>
<arrive>11:45</arrive>
<depart>13:00</depart>
</leg>
<leg>
<arrive>13:45</arrive>
</leg>
</schedule>
...
Rule: Within a leg, departures occur after arrivals, if there are
arrivals and departures. I see how to validate that, so long as a
string compare works. Something like: <xr:validate test="depart >
arrive" /> I'm not sure how the missing arrival or departure affects
that.
Rule: For any leg, the arrival is after the previous leg's departue.
Rule: For the first leg, there is no arrival.
Rule: For the last leg, there is no departure.
Rule: All legs except first and last have both an arrival and a departure.
2 questions:
How is best to express these rules?
How to do comparisons if the time were expressed in a manner not
easily compared as strings, e.g. "1/30/2006 08:00"?
Thanks.