cast-content-type 027 (AB)

Tests casting from a binary type to am XML content-type.

Test ab-cast-content-type-027.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="application/xml" name="caster">
                <p:with-input>
                    <p:inline content-type="application/octet-stream" document-properties="map{'base-uri' : 'http://xproc-test.org',                         'serialization' : map{'method' : 'adaptive'},                         'additional' : 'property'}">This is just a binary.</p:inline>
                </p:with-input>
            </p:cast-content-type>
            
            <p:cast-content-type content-type="application/xml" name="properties">
                <p:with-input select="p:document-properties(.)"/>
            </p:cast-content-type>
            
            <p:wrap-sequence wrapper="result">
                <p:with-input pipe="@caster @properties"/>
            </p:wrap-sequence>
        </p:declare-step>
    
MorganaXProc passing XML Calabash failing

Schematron validation


        <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
            <s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
            <s:ns prefix="c" uri="http://www.w3.org/ns/xproc-step"/>
            <s:pattern>
                <s:rule context="/">
                    <s:assert test="result">The root element is not 'result'.</s:assert>
                    <s:assert test="result/c:data">The root element does not have a child 'c:data'.</s:assert>
                    <s:assert test="result/c:data/@content-type='application/octet-stream'">The content-type attribute is not correct.</s:assert>
                    <s:assert test="result/c:data/@encoding='base64'">The encoding attribute is not 'base64'.</s:assert>
                    <s:assert test="result/c:data/text()='VGhpcyBpcyBqdXN0IGEgYmluYXJ5Lg=='">The content is not correct.</s:assert>
                    <s:assert test="result/fn:map">Root element does not have a 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']='application/xml'">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 no serialization property.</s:assert>
                </s:rule>
            </s:pattern>
        </s:schema>
    

Revision history

27 Dec 2019, Achim Berndzen

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