<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/nw-cdata-sections-004.xml"
        name="nw-cdata-sections-004.xml"
        expected="pass"
        serialized="true">
   <t:info>
      <t:title>nw-cdata-sections-004</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 xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
         <p:output port="result"
                   serialization="map{'method':'xml', 'indent':false(),                                  'cdata-section-elements': ('Q{}pre', 'Q{}code')}"/>
         <p:identity>
            <p:with-input href="../documents/serial.xml"/>
         </p:identity>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                queryBinding="xslt2">
         <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="contains(., 'pre&gt;&lt;![CDATA[')">The pre element was not serialized as a cdata section</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="nw-cdata-sections-004.xml">
      <serialization>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;doc&gt;&lt;title&gt;Serialization tests&lt;/title&gt;&lt;p&gt;Some &lt;code&gt;&lt;![CDATA[code]]&gt;&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;![CDATA[
  And a “pre”.
]]&gt;&lt;/pre&gt;&lt;/doc&gt;</serialization>
   </t:result>
</t:test>
