saving result / sequence problem

Dear experts,

I have a working pipeline attached below. I'm trying to extend it to
save the output which appears as result of the very last step on the
console. Which works fine if I don't use for-each within the pipe.
I have commented it out to see if my approach works at all. It does.

If I leave the for-each step in, an error is thrown, it says that there
are xx documents on the input port which aren't expected. 

Would you please have a look and tell me where I'm going wrong?

Many thanks in advance!
Stefanie Haupt

This is my pipeline (actually it's much longer but I managed to shorten
it down):

<?xml version="1.0"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
 xmlns:c="http://www.w3.org/ns/xproc-step"
 xmlns:ex="http://www.example.com"
 name="main">
 <p:input port="parameters" kind="parameter" primary="true"/> 
 <p:input port="source" sequence="true"/>
 <p:output port="result" sequence="true">
  <p:pipe port="result" step="last"/>
 </p:output>
 
  <p:variable name="input"
  select="'file:///home/stefanie/XML'">
  <p:empty/>
 </p:variable>
 
 <!-- list directories  (level 1) -->
 <p:directory-list name="directories">
  <p:with-option name="path" select="$input">
   <p:empty/>
  </p:with-option>
 </p:directory-list>
  
 <!--  loop 2nd level-->
<!-- <p:for-each name="directoryloop">
  
  <p:output port="result" sequence="true"/>
  <p:iteration-source select="/c:directory/c:directory"/>

  <!-\- provide files and directories -\->
  <p:variable name="dirpath"
   select="p:resolve-uri(concat($input,'/', c:directory/@name))"/>
  
  <p:directory-list>
   <p:with-option name="path" select="$dirpath"/>
  </p:directory-list>
    
 </p:for-each> -->
 
 <!-- would want to ideally wrap the last output as it is a list of
files to be able to store it as xml but
 no name is accepted for wrap, tested: c:result, result, ex:result, I'm
out of ideas here 
 
 <p:wrap-sequence>
  <p:with-option name="wrapper" select="ex:result"/>
  </p:wrap-sequence>-->
 
 <p:store name="log">
  <p:with-option name="href"
select="'file:///home/stefanie/loglaststep.log'"/>
 </p:store> 
 
 <p:identity name="last">
  <p:input port="source" sequence="true">   
   <p:pipe port="result" step="log"/>
  </p:input>
 </p:identity> 
 
</p:declare-step>

-- 
Stefanie Haupt

Received on Friday, 26 February 2010 17:22:50 UTC