Mercurial > hg > ooxml
view visualise.xpl @ 44:5b2333e59d91
updated html, ascii output to new raw doctype
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Sun, 07 May 2017 11:56:02 +0100 |
parents | ac6d1ca099f7 |
children | 5d9806f90896 |
line wrap: on
line source
<?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" 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: xproc --input source=sample2/xl/worksheets/sheet1.xml visualise.xpl elabDir=file:/d/MT/sonra/OOXML</div> </p:documentation> <p:option name="elabDir" required="true"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <div>Directory where stylesheets, other info for stylesheet elaboration are found</div> </p:documentation> </p:option> <p:option name="format"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <div>If supplied, then use as stylesheet (located relative to elabDir), to produce pretty output (e.g. ascii, html)</div> </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> <div>Use cell format and other cues in order to assign classes to cells</div> </p:documentation> </p:load> <p:xslt name="format"> <p:input port="source"> <p:pipe step="vis" port="source"/> </p:input> <p:input port="stylesheet"> <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="ssm"> <p:with-option name="href" select="concat($elabDir,'/shared.xsl')"/> <p:documentation> <div>Detect and tabulate shared formalae master cells</div> </p:documentation> </p:load> <p:xslt name="shared"> <p:input port="source"> <p:pipe step="vis" port="source"/> </p:input> <p:input port="stylesheet"> <p:pipe step="ssm" port="result"/> </p:input> <p:with-param name="elabDir" select="$elabDir"/> <p:with-param name="xlDir" select="$root"/> </p:xslt> <p:load name="ss2"> <p:with-option name="href" select="concat($elabDir,'/rect.xsl')"/> </p:load> <p:xslt name="rect"> <p:input port="source"> <p:pipe step="format" port="result"/> </p:input> <p:input port="stylesheet"> <p:pipe step="ss2" 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="ssr"> <p:with-option name="href" select="concat($elabDir,'/refs.xsl')"/> <p:documentation> <div>Tokenise cell formulae and extract local, range and external references</div> </p:documentation> </p:load> <p:xslt name="refs"> <p:input port="source"> <p:pipe step="rect" port="result"/> </p:input> <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"> <p:with-option name="href" select="concat($elabDir,'/refs2.xsl')"/> <p:documentation> <div>Invert refs data into a map from cell to cells which point to it</div> </p:documentation> </p:load> <p:xslt name="refs2"> <p:input port="source"> <p:pipe step="refs" port="result"/> </p:input> <p:input port="stylesheet"> <p:pipe step="ssr2" port="result"/> </p:input> </p:xslt> <p:load name="ssg"> <p:with-option name="href" select="concat($elabDir,'/merge.xsl')"/> <p:documentation> <div>Combine rectangular array and inverted ref table</div> </p:documentation> </p:load> <p:xslt name="merge"> <p:input port="source"> <p:pipe step="rect" port="result"/> <p:pipe step="refs2" port="result"/> </p:input> <p:input port="stylesheet"> <p:pipe step="ssg" port="result"/> </p:input> </p:xslt> <p:choose> <p:when test="p:value-available('format')"> <p:load name="ss3"> <p:with-option name="href" select="concat($elabDir,'/',$format)"/> </p:load> <p:xslt name="fmt"> <p:input port="source"> <p:pipe step="merge" port="result"/> </p:input> <p:input port="stylesheet"> <p:pipe step="ss3" port="result"/> </p:input> </p:xslt> </p:when> <p:otherwise> <p:identity> <p:input port="source"> <p:pipe step="merge" port="result"/> </p:input> </p:identity> </p:otherwise> </p:choose> </p:pipeline>