XProc and problem with schema aware processing

<oXygen/> general issues.
matsek
Posts: 11
Joined: Tue Nov 01, 2011 12:24 pm

XProc and problem with schema aware processing

Post by matsek » Wed Dec 14, 2011 11:43 pm

Hi,

I am trying to run an XProc pipeline where some XML files are first validated against an XSD and then against a Schematron schema. I get an error in the latter step saying that:

"The transformation is not schema-aware, so the source document must be untyped"

I understand that the XSD validation step adds typing information to the XML infoset that is passed to the second step, which then complains about this. How to workaround this?

Thanks,
Mats

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Re: XProc and problem with schema aware processing

Post by george » Thu Dec 22, 2011 12:04 pm

Hi,

You can pipe directly the XML to the Schematron validation and sink the result of the XML Schema validation. For example the following pipeline

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="main"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
<p:input port="source">
<p:document href="test.xml"/>
</p:input>
<p:output port="result"/>

<p:validate-with-xml-schema>
<p:input port="schema">
<p:document href="test.xsd"/>
</p:input>
</p:validate-with-xml-schema>

<p:validate-with-schematron>
<p:input port="schema">
<p:document href="test.sch"/>
</p:input>
<p:input port="parameters"><p:empty/></p:input>
</p:validate-with-schematron>
</p:declare-step>
can be changed to

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="main"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
<p:input port="source">
<p:document href="test.xml"/>
</p:input>
<p:output port="result"/>

<p:validate-with-xml-schema>
<p:input port="schema">
<p:document href="test.xsd"/>
</p:input>
</p:validate-with-xml-schema>

<p:sink/>

<p:validate-with-schematron>
<p:input port="source">
<p:pipe port="source" step="main"/>
</p:input>
<p:input port="schema">
<p:document href="test.sch"/>
</p:input>
<p:input port="parameters"><p:empty/></p:input>
</p:validate-with-schematron>
</p:declare-step>
Best Regards,
George
George Cristian Bina

Post Reply