XPath/XQuery gYear-equal function


Returns true if the two xs:gYear values have the same starting instant.

Operator Mapping

Defines the semantics of the "eq" operator when applied to two xs:gYear values. Also used in the definition of the "ne" operator.


$arg1 as xs:gYear,
$arg2 as xs:gYear
) as xs:boolean


This function is deterministic, context-dependent, and focus-independent. It depends on implicit-timezone.


The starting instants of $arg1 and $arg2 are calculated by supplying the missing components of $arg1 and $arg2 from the xs:dateTime template xxxx-01-01T00:00:00. The function returns the result of comparing these two starting instants using op:dateTime-equal.


Assume that the dynamic context provides an implicit timezone value of -05:00. Assume, also, that the xs:dateTime template is xxxx-01-01T00:00:00.

op:gYear-equal(xs:gYear("2005-12:00"), xs:gYear("2005+12:00")) returns false(). The starting instants are 2005-01-01T00:00:00-12:00 and 2005-01-01T00:00:00+12:00, respectively, and normalize to 2005-01-01T12:00:00Z and 2004-12-31T12:00:00Z.

The expression op:gYear-equal(xs:gYear("1976-05:00"), xs:gYear("1976")) returns true().