Tests that XML can be cast to Java properties.
Test java-properties-008.xml is expected to pass.
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:ex="https://xmlcalabash.com/ns/examples" xmlns:p="http://www.w3.org/ns/xproc" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-inline-prefixes="ex xs cx" name="main" version="3.0">
<p:output port="result"/>
<p:cast-content-type content-type="text/x-java-properties">
<p:with-input>
<properties>
<comment> Hello, world.</comment>
<entry key="first">One</entry>
<entry key="second">One</entry>
<entry key="second">Two</entry>
<entry key="three">“Several”
lines‽</entry>
</properties>
</p:with-input>
</p:cast-content-type>
<p:wrap-sequence wrapper="props"/>
</p:declare-step>
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<s:pattern>
<s:rule context="/">
<s:assert test="props">The document root is not correct.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/props">
<s:assert test="contains(., '# Hello, world')">Comment is missing.</s:assert>
<s:assert test="contains(replace(., '
', ''), '
first=One
')">first is missing.</s:assert>
<s:assert test="contains(replace(., '
', ''), '
second=Two
')">second is missing.</s:assert>
<s:assert test="contains(replace(., '
', ''), '
three=\u201CSeveral\u201D\nlines\u203D
')">third is missing.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Created test.