Previous: , Up: Record Polymorphism   [Contents]


2.5.2 Type Predicates

function: xs:boolean R:is-record (item as item())

xmlns:R="http://mikegerwitz.com/hoxsl/record"

Determine whether the given item is a record.

Definition:

<function name="R:is-record"  as="xs:boolean">
  <param name="item"  as="item()" />

  <sequence select="$item instance of element() and exists( $item/_R:types )" />
</function>
function: xs:boolean R:is-a (type as xs:QName, Record as element( R:Record ))

xmlns:R="http://mikegerwitz.com/hoxsl/record"

Predicate to determine whether record or any of its supertypes is of type type.

All records are of type R:Record.

Definition:

<function name="R:is-a"  as="xs:boolean">
  <param name="type"  as="xs:QName" />
  <param name="Record"  as="element( R:Record )" />

  <sequence select="$type = $R:qname or exists( $Record/_R:types/element()[ node-name( . ) = $type ] )" />
</function>