Poor man's Pipeline

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
     let $step := $steps[1]
     let $newdoc := 
         if (exists($doc))
              let $xslt := doc($step)
                 if (ends-with($step,".xsl"))
                 then transform:transform($doc,$xslt,())
                 else $doc
            if (ends-with($step,".xls"))
            then doc(concat("",$step))
            else doc($step)
        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:;/db/Wiki/graph2svg/xsl2fire.xsl;/db/Wiki/graph2svg/fires.xsl;/db/Wiki/graph2svg/xmsgr2svg.xsl 

; is not the best choice of a separator. the pipe symbol would be better.