<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        serialized="true"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
  <t:title>nw-cdata-sections-001</t:title>
  <t:revision-history>
    <t:revision>
      <t:date>2026-05-09</t:date>
      <t:author>
        <t:name>Norman Tovey-Walsh</t:name>
      </t:author>
      <t:description xmlns="http://www.w3.org/1999/xhtml">
        <p>Test setting the cdata-section-elements property</p>
      </t:description>
    </t:revision>
  </t:revision-history>
</t:info>
<t:pipeline>
  <p:declare-step version="3.0"
                  xmlns:p="http://www.w3.org/ns/xproc">
    <p:output port="result"
              serialization="map{'method':'xml', 'indent':false(),
                                 'cdata-section-elements': 'code'}"/>
    <p:identity>
      <p:with-input href="../documents/serial.xml"/>
    </p:identity>
  </p:declare-step>
</t:pipeline>
<t:schematron>
  <s:schema queryBinding="xslt2"
            xmlns:s="http://purl.oclc.org/dsdl/schematron"
            xmlns="http://www.w3.org/1999/xhtml">
    <s:pattern>
      <s:rule context="/">
        <s:assert test="serialization">The pipeline result is not serialized</s:assert>
      </s:rule>
    </s:pattern>
    <s:pattern>
      <s:rule context="/serialization">
        <s:assert test="contains(., 'code&gt;&lt;![CDATA[code]]')"
                  >The code element was not serialized as a cdata section</s:assert>
        <s:assert test="not(contains(., 'pre&gt;&lt;![CDATA['))"
                  >The pre element was serialized as a cdata section</s:assert>
      </s:rule>
    </s:pattern>
  </s:schema>
</t:schematron>
</t:test>
