ndw / xmlcalabash1

XML Calabash, an XProc processor
http://xmlcalabash.com/
108 stars 41 forks source link

sequences should not be allowed on non-sequence inputs #159

Open josteinaj opened 10 years ago

josteinaj commented 10 years ago

Calabash version used: 1.0.16 (for Saxon 9.5.1.3/EE)

Empty sequence as default connection The following does not throw an error, but instead provides an empty sequence on the result port:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
    <p:input port="source">
        <p:empty/>
    </p:input>
    <p:output port="result" sequence="true"/>
    <p:identity/>
</p:declare-step>

Two documents as default connection The following does not throw an error, but instead provides the two default input documents on the result port:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
    <p:input port="source" sequence="false">
        <p:inline>
            <doc/>
        </p:inline>
        <p:inline>
            <doc/>
        </p:inline>
    </p:input>
    <p:output port="result" sequence="true"/>
    <p:identity/>
</p:declare-step>

Two documents on the default readable port The following throws a XD0006 error as expected:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step" xmlns:test="#" version="1.0">
    <p:input port="source" sequence="false">
        <p:inline>
            <doc/>
        </p:inline>
        <p:inline>
            <doc/>
        </p:inline>
    </p:input>
    <p:output port="result" sequence="true"/>

    <p:declare-step type="test:test">
        <p:input port="source" sequence="false"/>
        <p:output port="result" sequence="true"/>
        <p:identity/>
    </p:declare-step>

    <test:test/>

</p:declare-step>

Two documents on explicit connection The following gives two output documents instead of throwing an error:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step" xmlns:test="#" version="1.0">

    <p:output port="result" sequence="true"/>

    <p:declare-step type="test:test">
        <p:input port="source" sequence="false"/>
        <p:output port="result" sequence="true"/>
        <p:identity/>
    </p:declare-step>

    <p:add-attribute match="/*" attribute-name="calabash-version" name="doc">
        <p:input port="source">
            <p:inline>
                <c:result/>
            </p:inline>
        </p:input>
        <p:with-option name="attribute-value" select="p:system-property('p:product-version')"/>
    </p:add-attribute>

    <test:test>
        <p:input port="source">
            <p:pipe port="result" step="doc"/>
            <p:pipe port="result" step="doc"/>
        </p:input>
    </test:test>

</p:declare-step>

Output of last pipeline:

<c:result xmlns:c="http://www.w3.org/ns/xproc-step" xmlns:test="#" calabash-version="1.0.16 (for Saxon 9.5.1.3/EE)"/>
<c:result xmlns:c="http://www.w3.org/ns/xproc-step" xmlns:test="#" calabash-version="1.0.16 (for Saxon 9.5.1.3/EE)"/>
ndw commented 10 years ago

Yeah, there are clearly some issues here.