Add R:is-record predicate
* src/record.xsl (R:is-record): added * test/record.xspec: add tests for R:is-recordmaster
parent
7196a2f0c6
commit
a921741f09
|
@ -517,6 +517,18 @@
|
||||||
@subsection Type Predicates
|
@subsection Type Predicates
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Determine whether the given @var{item} is a record.
|
||||||
|
-->
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Predicate to determine whether @var{record} or any of its supertypes is of
|
Predicate to determine whether @var{record} or any of its supertypes is of
|
||||||
type @var{type}.
|
type @var{type}.
|
||||||
|
|
|
@ -281,6 +281,41 @@
|
||||||
</scenario>
|
</scenario>
|
||||||
|
|
||||||
|
|
||||||
|
<scenario label="R:is-record">
|
||||||
|
<scenario label="given a record">
|
||||||
|
<call function="R:is-record">
|
||||||
|
<param name="Record"
|
||||||
|
select="R:make-record-header( 0 )" />
|
||||||
|
</call>
|
||||||
|
|
||||||
|
<expect label="returns true()"
|
||||||
|
test="$x:result = true()" />
|
||||||
|
</scenario>
|
||||||
|
|
||||||
|
|
||||||
|
<scenario label="given a non-record element">
|
||||||
|
<call function="R:is-record">
|
||||||
|
<param name="Record"
|
||||||
|
select="n:element( QName( '', 'foo' ) )" />
|
||||||
|
</call>
|
||||||
|
|
||||||
|
<expect label="returns false()"
|
||||||
|
test="$x:result = false()" />
|
||||||
|
</scenario>
|
||||||
|
|
||||||
|
|
||||||
|
<scenario label="given a non-record atomic">
|
||||||
|
<call function="R:is-record">
|
||||||
|
<param name="Record"
|
||||||
|
select="5" />
|
||||||
|
</call>
|
||||||
|
|
||||||
|
<expect label="returns false()"
|
||||||
|
test="$x:result = false()" />
|
||||||
|
</scenario>
|
||||||
|
</scenario>
|
||||||
|
|
||||||
|
|
||||||
<scenario label="R:is-compatible">
|
<scenario label="R:is-compatible">
|
||||||
<scenario label="with super- and sub-types of same slot count">
|
<scenario label="with super- and sub-types of same slot count">
|
||||||
<call function="R:is-compatible">
|
<call function="R:is-compatible">
|
||||||
|
|
Loading…
Reference in New Issue