yaml-002
Tests that YAML can be parsed.
Test 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"
xmlns:t="http://xproc.org/ns/testsuite/3.0" 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>
Result
<doc xmlns:t="http://xproc.org/ns/testsuite/3.0">test: 1
offsets:
- 1
- 2
- 3
simple: true
</doc>
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 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(., '
- 1
')">There’s no array value 1.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 03 Jan 2025, Norm Tovey-Walsh
- Created test.