cast-content-type 014 (AB)

Tests casting from an HTML content type to a text document.

Test ab-cast-content-type-014.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:cast-content-type content-type="text/plain" name="caster">
      <p:with-input>
         <p:inline content-type="text/html" document-properties="map{'base-uri' : 'http://xproc-test.org',                         'serialization' : map{'omit-xml-declaration' : true()},                         'additional' : 'property'}">
            <html/>
         </p:inline>
      </p:with-input>
   </p:cast-content-type>
   <p:wrap-sequence wrapper="text" name="text-wrapper"/>
   <p:cast-content-type content-type="application/xml" name="properties">
      <p:with-input select="p:document-properties(.)" pipe="@caster"/>
   </p:cast-content-type>
   <p:wrap-sequence wrapper="result">
      <p:with-input pipe="@text-wrapper @properties"/>
   </p:wrap-sequence>
</p:declare-step>
MorganaXProc passing XML Calabash passing

Schematron validation


<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="result">The root element is not result.</s:assert>
         <s:assert test="matches(result/text, '&lt;html\s*/&gt;')                                     or matches(result/text, '&lt;html\s*&gt;&lt;/html&gt;')">result/text is not '&lt;html /&gt;</s:assert>
         <s:assert test="result/fn:map">Root element does not have child 'fn:map'.</s:assert>
         <s:assert test="result/fn:map/fn:string[@key='base-uri']='http://xproc-test.org'">The base-uri property is not correct.</s:assert>
         <s:assert test="result/fn:map/fn:string[@key='content-type']='text/plain'">The content-type property is not correct.</s:assert>
         <s:assert test="result/fn:map/fn:string[@key='additional']='property'">The additional property is not correct.</s:assert>
         <s:assert test="not(result/fn:map/fn:map[@key='serialization'])">There should be is no serialization property.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

27 Dec 2019, Achim Berndzen

Initial tests for the new iteration of p:cast-content-type