annotate visualise.xpl @ 33:27bffc66ce10

external vars preserved, [0]!... == internal handled, but note that children of ref may not be contiguous by name anymore
author Henry S. Thompson <ht@markup.co.uk>
date Wed, 12 Apr 2017 17:43:54 +0100
parents 8309dcfce613
children ae605b77d1e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
1 <?xml version='1.0'?>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
2 <!DOCTYPE p:pipeline SYSTEM "../../../WWW/XML/XProc/docs/schemas/xproc.dtd" >
27
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
3 <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">
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
4 <p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
5
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
6 <p:documentation xmlns="http://www.w3.org/1999/xhtml">
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
7 <div>Run this e.g. as follows:
13
f78e8c55c06b three steps now
Henry S. Thompson <ht@markup.co.uk>
parents: 12
diff changeset
8 xproc --input source=sample2/xl/worksheets/sheet1.xml visualise.xpl elabDir=file:/d/MT/sonra/OOXML</div>
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
9 </p:documentation>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
10
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
11 <p:option name="elabDir" required="true">
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
12 <p:documentation xmlns="http://www.w3.org/1999/xhtml">
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
13 <div>Directory where stylesheets, other info for stylesheet elaboration are found</div>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
14 </p:documentation>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
15 </p:option>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
16
17
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
17 <p:option name="format">
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents: 13
diff changeset
18 <p:documentation xmlns="http://www.w3.org/1999/xhtml">
25
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
19 <div>If supplied, then use as stylesheet (located relative to elabDir), to
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
20 produce pretty output (e.g. ascii, html)</div>
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents: 13
diff changeset
21 </p:documentation>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents: 13
diff changeset
22 </p:option>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents: 13
diff changeset
23
27
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
24 <p:variable name="base" select="base-uri()">
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
25 <p:pipe step="vis" port="source"/>
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
26 </p:variable>
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
27 <p:variable name="buPat" select="'^(.*/xl/)worksheets/sheet([^/]*).xml$'"/>
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
28
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
29 <!-- Will only work in XProc 3 :-( <p:variable name="baseParts" select="analyze-string($base,)"/>-->
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
30
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
31 <p:variable name="root" select="analyze-string($base,$buPat)/xf:match/xf:group[@nr=1]"/>
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
32 <p:variable name="sheet-number" select="analyze-string($base,$buPat)/xf:match/xf:group[@nr=2]"/>
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
33 <!--<cx:message>
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
34 <p:with-option name="message" select="concat($base,'|',$sheet-number,'|')"/>
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
35 </cx:message>-->
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
36
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
37 <p:load name="ss1">
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
38 <p:with-option name="href" select="concat($elabDir,'/format.xsl')"/>
25
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
39 <p:documentation>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
40 <div>Use cell format and other cues in order to assign classes to cells</div>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
41 </p:documentation>
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
42 </p:load>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
43
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
44 <p:xslt name="format">
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
45 <p:input port="source">
13
f78e8c55c06b three steps now
Henry S. Thompson <ht@markup.co.uk>
parents: 12
diff changeset
46 <p:pipe step="vis" port="source"/>
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
47 </p:input>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
48 <p:input port="stylesheet">
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
49 <p:pipe step="ss1" port="result"/>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
50 </p:input>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
51 <p:with-param name="elabDir" select="$elabDir"/>
27
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
52 <p:with-param name="xlDir" select="$root"/>
19
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
53 </p:xslt>
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
54
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
55 <p:load name="ssr">
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
56 <p:with-option name="href" select="concat($elabDir,'/refs.xsl')"/>
25
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
57 <p:documentation>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
58 <div>Tokenise cell formulae and extract local, range and external references</div>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
59 </p:documentation>
19
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
60 </p:load>
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
61
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
62 <p:xslt name="refs">
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
63 <p:input port="source">
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
64 <p:pipe step="vis" port="source"/>
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
65 </p:input>
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
66 <p:input port="stylesheet">
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
67 <p:pipe step="ssr" port="result"/>
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
68 </p:input>
27
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
69 <p:with-param name="sheet-number" select="$sheet-number"/>
8309dcfce613 preparing for variable deref
Henry S. Thompson <ht@markup.co.uk>
parents: 26
diff changeset
70 <p:with-param name="xlDir" select="$root"/>
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
71 </p:xslt>
25
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
72
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
73 <p:load name="ssr2">
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
74 <p:with-option name="href" select="concat($elabDir,'/refs2.xsl')"/>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
75 <p:documentation>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
76 <div>Invert refs data into a map from cell to cells which point to it</div>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
77 </p:documentation>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
78 </p:load>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
79
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
80 <p:xslt name="refs2">
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
81 <p:input port="source">
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
82 <p:pipe step="refs" port="result"/>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
83 </p:input>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
84 <p:input port="stylesheet">
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
85 <p:pipe step="ssr2" port="result"/>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
86 </p:input>
a5125a2e77ea towards inverted map of refs
Henry S. Thompson <ht@markup.co.uk>
parents: 19
diff changeset
87 </p:xslt>
19
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
88
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
89 <p:load name="ss2">
12
01e125d722be widening scope so better names
Henry S. Thompson <ht@markup.co.uk>
parents: 10
diff changeset
90 <p:with-option name="href" select="concat($elabDir,'/rect.xsl')"/>
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
91 </p:load>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
92
13
f78e8c55c06b three steps now
Henry S. Thompson <ht@markup.co.uk>
parents: 12
diff changeset
93 <p:xslt name="rect">
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
94 <p:input port="source">
10
01e80c7a9575 simple ascii type matrix output working
Henry S. Thompson <ht@markup.co.uk>
parents: 8
diff changeset
95 <p:pipe step="format" port="result"/>
26
d2ca3ea1f5ae plumb in and use inverted ref table (via key)
Henry S. Thompson <ht@markup.co.uk>
parents: 25
diff changeset
96 <p:pipe step="refs2" port="result"/>
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
97 </p:input>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
98 <p:input port="stylesheet">
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
99 <p:pipe step="ss2" port="result"/>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
100 </p:input>
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
101 </p:xslt>
12
01e125d722be widening scope so better names
Henry S. Thompson <ht@markup.co.uk>
parents: 10
diff changeset
102
17
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
103 <p:choose>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
104 <p:when test="p:value-available('format')">
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
105 <p:load name="ss3">
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
106 <p:with-option name="href" select="concat($elabDir,'/',$format)"/>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
107 </p:load>
19
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 17
diff changeset
108 <p:xslt name="fmt">
17
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
109 <p:input port="source">
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
110 <p:pipe step="rect" port="result"/>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
111 </p:input>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
112 <p:input port="stylesheet">
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
113 <p:pipe step="ss3" port="result"/>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
114 </p:input>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
115 </p:xslt>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
116 </p:when>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
117 <p:otherwise>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
118 <p:identity/>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
119 </p:otherwise>
a874f2a81ed2 default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
120 </p:choose>
8
785187b9caef working toward doing an ascii-rectangle repr of a sheet
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
121 </p:pipeline>