yaml-002

Tests that YAML can be parsed.

Test yaml-002.xml is expected to pass.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
   <p:output port="result"/>
   <p:identity>
      <p:with-input>
         <p:inline content-type="application/json" expand-text="false">
{"test": 1, "simple": true, "offsets": [1,2,3]}
          </p:inline>
      </p:with-input>
   </p:identity>
   <p:cast-content-type content-type="application/yaml"/>
   <p:cast-content-type content-type="text/plain"/>
   <p:wrap-sequence wrapper="doc"/>
</p:declare-step>

Schematron validation

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="doc">The result isn’t a doc.</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/doc">
         <s:assert test="contains(., 'test: 1')">There’s no test.</s:assert>
         <s:assert test="contains(., 'simple: true')">There’s no simple.</s:assert>
         <s:assert test="contains(., '&#xA;- 1&#xA;')">There’s no array value 1.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

03 Jan 2025, Norm Tovey-Walsh

Created test.