XProc is a wonderful thing, and very powerful. However for simple situations it may be overly complex. In the case of transforming an Excel spreadsheet to a visualisation, perhaps a simpler, more specific pipeline implementation might do.
The step-by step transformation in the last example leads to a recursive function and its front-door:
declare function local:execute-step($doc,$steps as xs:string* ) { if (empty($steps)) then $doc else let $step := $steps[1] let $newdoc := if (exists($doc)) then let $xslt := doc($step) return if (ends-with($step,".xsl")) then transform:transform($doc,$xslt,()) else $doc else if (ends-with($step,".xls")) then doc(concat("http://elev.at/lift?xls=",$step)) else doc($step) return local:execute-step($newdoc, subsequence($steps,2)) }; declare function local:execute-pipe($pipe as xs:string ,$last as xs:integer) { let $steps := subsequence(tokenize($pipe,";"),1,$last) return local:execute-step((),$steps) };
$last limits the steps to run for testing. Operations on steps is determined by the file suffix.
A simple interface:
let $last := xs:integer(request:get-parameter("last",999)) let $pipe := request:get-parameter("pipe",()) return local:execute-pipe($pipe,$last)
And a call:
; is not the best choice of a separator. the pipe symbol would be better.