Anonymous records added

* src/record.xsl (R:make-record-header#1): added
* test/record.xspec: R:make-record-header#1 scenario added
master
Mike Gerwitz 2016-03-27 11:01:20 -04:00
parent ae98699094
commit 7196a2f0c6
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
2 changed files with 32 additions and 0 deletions

View File

@ -249,6 +249,19 @@
select="QName( $R:ns, 'R:Record' )" /> select="QName( $R:ns, 'R:Record' )" />
<!--
Make a new anonymous record header containing @var{slots} slots.
Usually, you want a record to be named,
but anonymous records might be useful for temporary or grouped data.
-->
<function name="R:make-record-header" as="element( R:Record )">
<param name="slots" as="xs:integer" />
<sequence select="R:make-record-header( $R:qname, $slots, () )" />
</function>
<!-- <!--
Make a new record header for a record identified by @var{qname} containing Make a new record header for a record identified by @var{qname} containing
@var{slots} slots. @var{slots} slots.

View File

@ -51,6 +51,25 @@
select="QName( $slot-ns, 'd' )" /> select="QName( $slot-ns, 'd' )" />
<scenario label="R:make-record-header"> <scenario label="R:make-record-header">
<scenario label="with no name">
<call function="R:make-record-header">
<param name="slots" select="3" />
</call>
<expect label="produces an R:Record element"
test="$x:result instance of element( R:Record )" />
<expect label="R:Record type matches the generic R:Record"
test="R:is-a( $R:qname, $x:result )" />
<expect label="R:Record type does not match other QName"
test="not( R:is-a( $test-qname-2, $x:result ) )" />
<expect label="R:Record element contains number of slots"
test="R:slot-count( $x:result ) = 3" />
</scenario>
<scenario label="with no supertype"> <scenario label="with no supertype">
<call function="R:make-record-header"> <call function="R:make-record-header">
<param name="qname" select="$test-qname" /> <param name="qname" select="$test-qname" />