unique-id-010

Tests creating TypeID with a type.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/unique-id.xpl"/>
   <p:output port="result"/>
   <cx:unique-id match="/*/@typeid" flavor="typeid"
                 parameters="map{'type': 'prefix'}">
      <p:with-input>
         <doc typeid=""/>
      </p:with-input>
   </cx:unique-id>
</p:declare-step>

Result

<doc xmlns:cx="http://xmlcalabash.com/ns/extensions"
     xmlns:t="http://xproc.org/ns/testsuite/3.0" typeid="prefix_01jy4nq36kf3q8pd48gxpbj31w"/>

Schematron checks

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="doc">The document root is not doc.</s:assert>
         <s:assert test="doc/@typeid">No “typeid” attribute on doc.</s:assert>
         <s:assert test="string-length(doc/@typeid) eq 33">The “typeid” attribute is the wrong length.</s:assert>
         <s:assert test="starts-with(doc/@typeid, 'prefix_')">The “typeid” attribute has the wrong prefix.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

26 Oct 2024, Norm Tovey-Walsh
Created test.