<?xml-stylesheet type="text/xsl" href="/style/testcase.xsl"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite"
        xmlns:p="http://www.w3.org/ns/xproc"
        xmlns:c="http://www.w3.org/ns/xproc-step"
        xmlns:err="http://www.w3.org/ns/xproc-error">

<t:title>Test validrng-001</t:title>

<t:input port='source'>
<doc>
<title>Title</title>
<p>Some paragraph.</p>
</doc>
</t:input>

<t:input port="schema">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="doc"/>
  </start>
  <define name="doc">
    <element name="doc">
      <optional>
        <ref name="title"/>
      </optional>
      <zeroOrMore>
        <ref name="p"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="title">
    <element name="title">
      <text/>
    </element>
  </define>
  <define name="p">
    <element name="p">
      <text/>
    </element>
  </define>
</grammar>
</t:input>

<t:pipeline>
<p:declare-step version='1.0' name="pipeline">
<p:input port="source"/>
<p:input port="schema"/>
<p:output port="result"/>

<p:validate-with-relax-ng>
  <p:input port="source">
    <p:pipe step="pipeline" port="source"/>
  </p:input>
  <p:input port="schema">
    <p:pipe step="pipeline" port="schema"/>
  </p:input>
</p:validate-with-relax-ng>

</p:declare-step>
</t:pipeline>

<t:output port='result'>
<doc>
<title>Title</title>
<p>Some paragraph.</p>
</doc></t:output>

</t:test>

