RE: trouble with port in iteration

Hi,
 
The pipeline seems correct to me. I have tested it with our XProc
processor (I had to play with the paths a bit), and it seems to work.
For both valid and invalid documents, the pipeline creates c:result
documents with proper content.
My guess is that there is a p:for-each/p:try/p:catch bug in Calabash.
What happens if you try to run this pipeline (a simplified version of
yours):
 
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:c="http://www.w3.org/ns/xproc-step">
  <p:output port="result" sequence="true"/>
 
  <p:for-each>
    <p:iteration-source>
      <p:inline><doc1/></p:inline>
      <p:inline><doc2/></p:inline>
    </p:iteration-source>
 
    <p:output port="result" sequence="true">
      <p:pipe port="result" step="last"/>
    </p:output>
 
    <p:try>
      <p:group>
        <p:load href="i-do-not-exist.xml"/>
      </p:group>
      <p:catch>
        <p:identity>
          <p:input port="source">
            <p:inline><bang/></p:inline>
          </p:input>
        </p:identity>
      </p:catch>
    </p:try>
    <p:identity name="last"/>
  </p:for-each>
</p:declare-step>

Do you get the same error? If so, does anything change if you remove the
p:output element inside p:for-each? 
 
This is just guesswork from my side that may help to isolate the
problem. But you will need to wait for a response from Norm; I don't
really know Calabash code.
 
 
Regards,
Vojtech


________________________________

	From: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org]
On Behalf Of Paul Hermans
	Sent: Tuesday, March 17, 2009 4:03 PM
	To: xproc-dev@w3.org
	Subject: trouble with port in iteration
	
	
	Using Calabash.

	I have following try/catch which works both for valid and
non-valid docs.

	<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step">
	    <p:try>
	        <p:group>
	            <p:validate-with-xml-schema assert-valid="true"
mode="strict">
	                <p:input port="source">
	                    <p:document
	
href="file:///Users/paul/Desktop/R&amp;D/xmlschema/msData/simpleType/stE
056.xml"
	                    />
	                </p:input>
	                <p:input port="schema">
	                    <p:document
	
href="file:///Users/paul/Desktop/R&amp;D/xmlschema/msData/simpleType/stE
055.xsd"
	                    />
	                </p:input>
	            </p:validate-with-xml-schema>
	            <p:identity>
	                <p:input port="source">
	
<p:inline><c:result>valid</c:result></p:inline>
	                </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:store
	
href="/Users/paul/Desktop/R&amp;D/xmlschema/msData/simpleType/stE055.res
"
	        name="store"/>
	</p:declare-step>
	
	
	
	Now I'm doing the same within a loop
	
	
	
	<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
	
xmlns:wts="http://www.w3.org/XML/2004/xml-schema-test-suite/"
	    xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:xlink="http://www.w3.org/1999/xlink"
	    xpath-version="2.0">
	    <p:output port="result" sequence="true">
	        <p:pipe port="result" step="loop"/>
	    </p:output>
	    <p:load
href="/Users/paul/Desktop/R&amp;D/xmlschema/msMeta/SimpleType_w3c.xml"/>
	    <p:for-each name="loop">
	        <p:iteration-source
select="/wts:testSet/wts:testGroup[wts:instanceTest/wts:instanceDocument
]"/>
	        <p:output port="result" sequence="true">
	            <p:pipe port="result" step="write2file"/>
	        </p:output>
	        <p:variable name="xsd"
	
select="substring-after(/wts:testGroup/wts:schemaTest/wts:schemaDocument
/@xlink:href,'/')"/>
	        <p:variable name="xml"
	
select="substring-after(/wts:testGroup/wts:instanceTest/wts:instanceDocu
ment/@xlink:href,'/')"/>
	        <p:load name="schema">
	            <p:with-option select="$xsd" name="href"
	
xml:base="/Users/paul/Desktop/R&amp;D/xmlschema/"/>
	        </p:load>
	        <p:load name="instance">
	            <p:with-option select="$xml" name="href"
	
xml:base="/Users/paul/Desktop/R&amp;D/xmlschema/"/>
	        </p:load>
	        <p:try name="try">
	            <p:group>
	                <p:validate-with-xml-schema assert-valid="true"
mode="strict">
	                    <p:input port="source">
	                        <p:pipe port="result" step="instance"/>
	                    </p:input>
	                    <p:input port="schema">
	                        <p:pipe port="result" step="schema"/>
	                    </p:input>
	                </p:validate-with-xml-schema>
	                <p:identity>
	                    <p:input port="source">
	                        <p:inline>
	                            <c:result>valid</c:result>
	                        </p:inline>
	                    </p:input>
	                </p:identity>
	            </p:group>
	            <p:catch name="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:store name="write2file">
	             <p:with-option name="href"
select="concat('/Users/paul/Desktop/R&amp;D/xmlschema/',$xml,'.err')"/>
	        </p:store>
	    </p:for-each>
	</p:declare-step>
	
	
	As long as all files are valid, I do get the required output.
	Once I encounter a non-valid file, I get following error:

	Pipeline failed: err:XD0007: null  If sequence is not specified
on p:output, or has the value false, then it is a dynamic error if the
step does not produce exactly one document on the declared port.
	Something related to the error output on the catch?

	
	
	
	Kind Regards,
	Paul Hermans
	
	
	-------------------------
	
	
	
	

Received on Tuesday, 17 March 2009 15:42:06 UTC