<?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>Serialization test standalone-003</t:title>

<t:input port='source' href="../doc/s-input.xml"/>

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

  <p:store href="file:///tmp/standalone-003.xml"
	   omit-xml-declaration="false" encoding="UTF-8" standalone="omit"/>

  <p:string-replace match="c:result/text()">
    <p:input port="source">
      <p:inline><c:result>uri</c:result></p:inline>
    </p:input>
    <p:with-option name="replace"
		   select="concat('&quot;',p:base-uri(/),'&quot;')">
      <p:pipe step="main" port="source"/>
    </p:with-option>
  </p:string-replace>

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

<t:compare-pipeline>
<p:declare-step name="main" version="1.0">
<p:input port="uri"/>
<p:output port="result"/>

<p:exec name="diff"
	command="serdiff"
	source-is-xml="false"
	result-is-xml="false">
  <p:input port="source"><p:empty/></p:input>
  <p:with-option name="args"
	         select="concat('/tmp/standalone-003.xml ',
			        p:resolve-uri('../serialization/results/standalone-003.xml',
                                              /c:result))">
    <p:pipe step="main" port="uri"/>
  </p:with-option>
</p:exec>

<p:sink/>

<p:identity>
  <p:input port="source">
    <p:pipe step="diff" port="exit-status"/>
  </p:input>
</p:identity>

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

<t:output port="result"><c:result>0</c:result></t:output>

</t:test>


