Michael
Michael

Reputation: 285

XSD 1.1 compare 2 dates

Related: XSD 1.1 compare 2 dates

Here's my XML schema snippet:

<xs:complexType name="headerType">

    <xs:sequence>

      <xs:element name="ContentDate" type="dateTime" />

      <xs:element minOccurs="0" name="DeltaStart" type="lei:LEIDateTimeProfile" />

    </xs:sequence>

    <xs:assert test="empty(dateTime(./DeltaStart) gt dateTime(./ContentDate))" />

  </xs:complexType>

  <xs:element name="header" type="headerType" />

Any ideas why the following XML snippet is causing a validation error?

    <header>

        <ContentDate>2017-02-01T12:00:00Z</ContentDate>

        <DeltaStart>2017-02-01T12:00:00Z</DeltaStart>

    </header>

Here's the error message:

Assertion evaluation ('emtpy(dateTime(./DeltaStart) gt dateTime(./ContentDate))') for element 'LEIHeader' on schema type 'LEIHeaderType' did not succeed.
XPST0017 - Function does not exist: emtpy arity: 1.

Upvotes: 0

Views: 627

Answers (1)

Michael Kay
Michael Kay

Reputation: 163282

My guess would be that you misspelled "empty" as "emtpy". Either that, or it's a very strange error message.

(But applying the empty() function to the result of a "gt" comparison also seems a bit... shall we say quirky?)

Upvotes: 1

Related Questions