p:choose-031 (AB)

Test p:choose with different named secondary output ports.

Test ab-choose-031.xml is expected to pass.

The pipeline


        <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
            <p:output port="result"/>
            
            <p:choose name="choose">
                <p:when test="false()">
                    <p:output port="result" primary="true"/>
                    <p:output port="when-output">
                        <when xmlns=""/>
                    </p:output>
                    <p:identity>
                        <p:with-input><true xmlns=""/></p:with-input>
                    </p:identity>
                </p:when>
                <p:otherwise>
                    <p:output port="result" primary="true"/>
                    <p:output port="otherwise-output">
                        <otherwise xmlns=""/>
                    </p:output>
                    <p:identity>
                        <p:with-input><false xmlns=""/></p:with-input>
                    </p:identity>
                </p:otherwise>
            </p:choose>
            
            <p:wrap-sequence name="wrap1" wrapper="when">
                <p:with-input pipe="when-output@choose"/>
            </p:wrap-sequence>
            <p:wrap-sequence name="wrap2" wrapper="otherwise">
                <p:with-input pipe="otherwise-output@choose"/>
            </p:wrap-sequence>
            
            <p:wrap-sequence wrapper="result">
                <p:with-input pipe="@choose @wrap1 @wrap2"/>
            </p:wrap-sequence>
            
        </p:declare-step>
    
MorganaXProc passing XML Calabash passing

Schematron validation


        <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
            <s:pattern>
                <s:rule context="/">
                    <s:assert test="/result">Root element is not 'result'.</s:assert>
                    <s:assert test="/result/*[1]/name()='false'">The first child of result is not named 'false'.</s:assert>
                    <s:assert test="/result/*[2]/name()='when'">The second child of result is not named 'when'.</s:assert>
                    <s:assert test="/result/*[3]/name()='otherwise'">The third child of result is not named 'otherwise'.</s:assert>
                    <s:assert test="/result/otherwise/otherwise">'otherwise' does not have a child 'otherwise'.</s:assert>
                </s:rule>
            </s:pattern>
        </s:schema>
    

Revision history

05 Apr 2019, Achim Berndzen

New tests