diff visualise.xpl @ 27:8309dcfce613

preparing for variable deref
author Henry S. Thompson <ht@markup.co.uk>
date Mon, 10 Apr 2017 17:29:24 +0100
parents d2ca3ea1f5ae
children ae605b77d1e4
line wrap: on
line diff
--- a/visualise.xpl	Fri Apr 07 18:42:47 2017 +0100
+++ b/visualise.xpl	Mon Apr 10 17:29:24 2017 +0100
@@ -1,6 +1,7 @@
 <?xml version='1.0'?>
 <!DOCTYPE p:pipeline SYSTEM "../../../WWW/XML/XProc/docs/schemas/xproc.dtd" >
-<p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns:x="http://www.w3.org/1999/xhtml" version="1.0" name="vis">
+<p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns:x="http://www.w3.org/1999/xhtml" version="1.0" name="vis" xmlns:xf="http://www.w3.org/2005/xpath-functions" xmlns:cx="http://xmlcalabash.com/ns/extensions">
+ <p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
  
  <p:documentation xmlns="http://www.w3.org/1999/xhtml">
   <div>Run this e.g. as follows:
@@ -20,6 +21,19 @@
   </p:documentation>
  </p:option>
  
+ <p:variable name="base" select="base-uri()">
+  <p:pipe step="vis" port="source"/>
+ </p:variable>
+ <p:variable name="buPat" select="'^(.*/xl/)worksheets/sheet([^/]*).xml$'"/>
+ 
+ <!-- Will only work in XProc 3 :-( <p:variable name="baseParts" select="analyze-string($base,)"/>-->
+ 
+ <p:variable name="root" select="analyze-string($base,$buPat)/xf:match/xf:group[@nr=1]"/>
+ <p:variable name="sheet-number" select="analyze-string($base,$buPat)/xf:match/xf:group[@nr=2]"/>
+ <!--<cx:message>
+  <p:with-option name="message" select="concat($base,'|',$sheet-number,'|')"/>
+ </cx:message>-->
+ 
  <p:load name="ss1">
   <p:with-option name="href" select="concat($elabDir,'/format.xsl')"/>
   <p:documentation>
@@ -35,6 +49,7 @@
    <p:pipe step="ss1" port="result"/>
   </p:input>
   <p:with-param name="elabDir" select="$elabDir"/>
+  <p:with-param name="xlDir" select="$root"/>
  </p:xslt> 
  
  <p:load name="ssr">
@@ -51,6 +66,8 @@
   <p:input port="stylesheet">
      <p:pipe step="ssr" port="result"/>
     </p:input>
+  <p:with-param name="sheet-number" select="$sheet-number"/>
+  <p:with-param name="xlDir" select="$root"/>
  </p:xslt>
  
  <p:load name="ssr2">