XProc steps

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

p:validate-with-relaxng

<p:declare-step type="p:validate-with-relax-ng">
   <p:input port="source" primary="true"/>
   <p:input port="schema"/>
   <p:output port="result"/>
   <p:option name="dtd-attribute-values" select="'false'"/> <!-- boolean -->
   <p:option name="dtd-id-idref-warnings" select="'false'"/> <!-- boolean -->
   <p:option name="assert-valid" select="'true'"/> <!-- boolean -->
</p:declare-step>

With the help of the <p:validate-with-relax-ng> step, the XML documents from the input port (“source“) can be validated against a RELAX NG schema which is passed on to a further input port (“schema“). The appropriate results or outputs resulting from the validation are sent to the output port (“result“). Depending on the implementation of the processor, the output may have further information (PSVI) regarding the validation. Furthermore, the step has three options. Each option expects a Boolean value.

If the “dtd-attribute-values“ option is set to “true“, the processor will take into account RELAX NG-related attribute conventions during the processing. If “dtd-id-idref-warnings“ is set to “true“, the schemas which are not compatible with the RELAX NG DTD compatibility (in relation to ID/IDREF) will be treated as “invalide“ and the appropriate error message will be produced. If “assert-valid-true“ is set to “true“, a dynamic error will be outputted if the document is not “valide“.

Example

In the following example the input document is validated against an appropriate RELAX NG schema file.

<?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:document href="FilmCollection.xml"/>
   </p:input>
   <p:output port="result"/>
   <p:validate-with-relax-ng assert-valid="true">
      <p:input port="schema">
         <p:document href="relaxngschema.rng"/>
      </p:input>
   </p:validate-with-relax-ng>
</p:declare-step>

In the case a validation error occurs during the execution of this stylesheets, the appropriate message would be as follows:

XC0053 : XC0053 It is a dynamic error if the assert-valid option 
is true and the input document is not valid.
URL: http://www.w3.org/TR/xproc/#err.C0053