p:wrap 001 (NW)

Tests that p:wrap always produces application/xml, even when the input is some other content type.

Test nw-wrap-001.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline" version="3.0">
   <p:output port="result"/>
   <p:wrap match="element" wrapper="wrapper">
      <p:with-input>
         <p:inline content-type="image/svg+xml">
            <svg xmlns="http://www.w3.org/2000/svg">
               <rect x="10" y="10" width="20" height="20" fill="red"/>
            </svg>
         </p:inline>
      </p:with-input>
   </p:wrap>
   <p:cast-content-type content-type="application/xml" name="properties">
      <p:with-input select="p:document-properties(.)"/>
   </p:cast-content-type>
</p:declare-step>

Schematron validation


<s:schema xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:ns prefix="map" uri="http://www.w3.org/2005/xpath-functions"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="map:map">Root element is not 'map'.</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/map:map">
         <s:assert test="map:string[@key='content-type'] = 'application/xml'">Incorrect content type.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jan 2026, Norm Tovey-Walsh

Initial commit