W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2008

Unable to get a failed schema validation to output "invalid"

From: Costello, Roger L. <costello@mitre.org>
Date: Sat, 22 Nov 2008 11:41:22 -0500
To: "'xproc-dev@w3.org'" <xproc-dev@w3.org>, "Costello, Roger L." <costello@mitre.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB50283A7A47@IMCMBX3.MITRE.ORG>


Hi Folks,

I am trying to write a pipeline that validates an XML document against an XML Schema. It validation succeeds, output the XML document. If validation fails, output the string "invalid".

Below is the pipeline I wrote. It seems to work as I want when the XML document is valid (i.e. it outputs the XML document). But when the XML document is not valid, it does not behave as I want. Instead of outputting the string "invalid" it generates an error message. 

What am I doing wrong please?  /Roger

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:c="http://www.w3.org/ns/xproc-step">
        <p:input port="source">
            <p:document href="BookStore.xml"/>
        </p:input>
        <p:output port="result" />
    
    <p:try>
        <p:group>
            <p:validate-with-xml-schema assert-valid="true" mode="strict" name="myValidate">
                <p:input port="schema">
                    <p:document href="BookStore.xsd"/>
                </p:input>
            </p:validate-with-xml-schema>
            <p:identity>
                <p:input port="source">
                    <p:pipe step="myValidate" port="result"/>
                    </p:input>
            </p:identity>
        </p:group>
        <p:catch>
            <p:identity>
                <p:input port="source">
                    <p:inline><c:result>invalid</c:result></p:inline>
                    </p:input>
            </p:identity>
        </p:catch>
    </p:try>
    
</p:declare-step>
Received on Saturday, 22 November 2008 16:41:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 November 2008 16:41:57 GMT