-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgenerate-reading-text.xpl
208 lines (167 loc) · 7.15 KB
/
generate-reading-text.xpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:pxp="http://exproc.org/proposed/steps"
xmlns:pxf="http://exproc.org/proposed/steps/file" xmlns:f="http://www.faustedition.net/ns"
xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:l="http://xproc.org/library" name="main"
type="f:generate-reading-text" version="2.0">
<p:input port="source">
<p:empty/>
</p:input>
<p:input port="parameters" kind="parameter"/>
<p:output port="result" sequence="true"/>
<p:option name="paths" select="resolve-uri('paths.xml')"/>
<p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
<p:import href="library/store.xpl"/>
<p:import href="preprocess-reading-text-sources.xpl"/>
<!-- Parameter laden -->
<p:xslt name="config" template-name="param">
<p:input port="source"><p:empty/></p:input>
<p:input port="stylesheet"><p:document href="xslt/config.xsl"/></p:input>
<p:with-param name="path_config" select="$paths"></p:with-param>
</p:xslt>
<p:group>
<p:variable name="source" select="//c:param[@name='source']/@value">
<p:pipe port="result" step="config"/>
</p:variable>
<p:variable name="html" select="//c:param[@name='html']/@value">
<p:pipe port="result" step="config"/>
</p:variable>
<p:variable name="builddir" select="resolve-uri(//c:param[@name='builddir']/@value)">
<p:pipe port="result" step="config"/>
</p:variable>
<p:for-each name="load-sources">
<p:iteration-source select="//c:file">
<p:inline>
<c:directory>
<c:file href="print/A8_IIIB18.xml"/>
<c:file href="transcript/gsa/391098/391098.xml"/>
<c:file
href="transcript/dla_marbach/Cotta-Archiv_Goethe_23/Marbach_Deutsches_Literaturarchiv.xml"/>
<c:file href="print/C(1)4_IIIB24.xml"/>
</c:directory>
</p:inline>
</p:iteration-source>
<p:output port="result" primary="true" sequence="true"/>
<p:variable name="source-uri" select="resolve-uri(/c:file/@href, $source)"/>
<cx:message>
<p:with-option name="message" select="concat('Loading ', $source-uri)"/>
</cx:message>
<p:load>
<p:with-option name="href" select="$source-uri"/>
</p:load>
<pxp:set-base-uri>
<p:with-option name="uri" select="$source-uri"/>
</pxp:set-base-uri>
</p:for-each>
<p:for-each>
<p:variable name="source-uri" select="p:base-uri()"/>
<f:preprocess-reading-text-sources/>
<pxp:set-base-uri>
<p:with-option name="uri" select="$source-uri"/>
</pxp:set-base-uri>
</p:for-each>
<p:xslt template-name="faust" name="assemble">
<p:input port="stylesheet">
<p:document href="xslt/assemble-reading-text.xsl"/>
</p:input>
<p:input port="parameters">
<p:inline>
<c:param-set>
<c:param name="use-collection" value="true"/>
</c:param-set>
</p:inline>
</p:input>
</p:xslt>
<p:xslt name="cleanup">
<p:input port="stylesheet">
<p:document href="xslt/text-cleanup.xsl"/>
</p:input>
<p:input port="parameters">
<p:empty/>
</p:input>
</p:xslt>
<p:xslt name="app">
<p:input port="stylesheet"><p:document href="xslt/text-insert-app.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
<p:with-param name='builddir' select='$builddir'/>
</p:xslt>
<p:xslt name="postprocess">
<p:input port="stylesheet"><p:document href="xslt/text-postprocess.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</p:xslt>
<p:identity name="final-text"/>
<!-- Generate a list of interesting elements with context and store as XML and HTML -->
<p:xslt template-name="faust">
<p:input port="source"><p:pipe port="result" step="load-sources"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/assemble-reading-text.xsl"/></p:input>
<p:input port="parameters">
<p:inline>
<c:param-set>
<c:param name="use-collection" value="true"/>
</c:param-set>
</p:inline>
</p:input>
</p:xslt>
<p:xslt name="issue-178-list">
<p:input port="stylesheet"><p:document href="xslt/list-interesting-elements.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</p:xslt>
<p:store method="xml" indent="true">
<p:with-option name="href" select="resolve-uri('lesetext/issue-178.xml', $builddir)"/>
</p:store>
<!-- <p:xslt>
<p:input port="source"><p:pipe port="result" step="issue-178-list"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/apparatus.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
<p:with-param name="split" select="false()"/>
<p:with-param name="type" select="'lesetext'"/>
</p:xslt>
<p:store method="xhtml">
<p:with-option name="href" select="resolve-uri('www/print/issue-178.html', $builddir)"/>
</p:store>
-->
<!-- Perform some validation steps on the apparatus and store report as HTML -->
<p:xslt>
<p:input port="source"><p:pipe port="result" step="final-text"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/text-app-validate.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</p:xslt>
<p:store method="xhtml">
<p:with-option name="href" select="resolve-uri('lesetext/app-validation.html', $builddir)"/>
</p:store>
<p:xslt>
<p:input port="source"><p:pipe port="result" step="final-text"/></p:input>
<p:input port="stylesheet"><p:document href="tools/lem-vs-seg.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</p:xslt>
<p:store method="xhtml">
<p:with-option name="href" select="resolve-uri('lesetext/lem-vs-seg.html', $builddir)"/>
</p:store>
<!-- Generate the expansion map template -->
<p:xslt>
<p:input port="source"><p:pipe port="result" step="assemble"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/extract-abbr-template.xsl"/></p:input>
<p:input port="parameters"><p:empty/></p:input>
</p:xslt>
<p:store method="xml" indent="true">
<p:with-option name="href" select="resolve-uri('lesetext/expan-map.xml.in', $builddir)"/>
</p:store>
<!-- Store a copy of the assembled text to have a source for debugging the insert-app xslt -->
<p:store>
<p:input port="source"><p:pipe port="result" step="cleanup"/></p:input>
<p:with-option name="href" select="resolve-uri('lesetext/without-app.xml', $builddir)"/>
</p:store>
<!-- Store the final marked-up text -->
<p:store method="xml">
<p:input port="source"><p:pipe port="result" step="final-text"/></p:input>
<p:with-option name="href" select="resolve-uri('lesetext/faust.xml', $builddir)"/>
</p:store>
<!-- Store the final marked-up text -->
<p:store method="xml">
<p:input port="source"><p:pipe port="result" step="final-text"/></p:input>
<p:with-option name="href" select="resolve-uri('www/downloads/faust.xml', $builddir)"/>
</p:store>
<!-- additionally, pass out the real result -->
<p:identity><p:input port="source"><p:pipe port="result" step="final-text"/></p:input></p:identity>
</p:group>
</p:declare-step>