-
Notifications
You must be signed in to change notification settings - Fork 4
/
generate-all.xpl
352 lines (294 loc) · 14.6 KB
/
generate-all.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
<?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" version="1.0">
<p:input port="source"><p:empty/></p:input>
<p:input port="parameters" kind="parameter"/>
<p:output port="result" sequence="true">
<p:empty/>
</p:output>
<p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
<p:import href="http://xproc.org/library/store.xpl"/>
<p:import href="collect-metadata.xpl"/>
<p:import href="generate-search.xpl"/>
<p:import href="apply-edits.xpl"/>
<p:import href="collate-variants.xpl"/>
<p:import href="print2html.xpl"/>
<p:import href="generate-app.xpl"/>
<p:import href="generate-print.xpl"/>
<p:import href="generate-metadata-js.xpl"/>
<p:import href="metadata-html.xpl"/>
<p:import href="bibliography.xpl"/>
<p:import href="create-para-table.xpl"/>
<p:import href="testimony.xpl"/>
<p:import href="generate-reading-text.xpl"/>
<!--
<p:import href="generate-indexes.xpl"/>
-->
<!-- Parameter laden -->
<p:parameters name="config">
<p:input port="parameters">
<p:document href="config.xml"/>
<p:pipe port="parameters" step="main"></p:pipe>
</p:input>
</p:parameters>
<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>
<!--Step 1a Archivmetadaten -->
<p:load><p:with-option name="href" select="resolve-uri('archives.xml', resolve-uri($source))"/></p:load>
<cx:message log="info">
<p:with-option name="message" select="'Converting archive metadata to js...'"/>
</cx:message>
<p:xslt>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/create-archives-metadata.xsl"/></p:input>
</p:xslt>
<p:store method="text">
<p:with-option name="href" select="resolve-uri('www/data/archives.js', $builddir)"/>
</p:store>
<!-- ############ STEP 1: Create list of all transcripts -->
<!-- Collect all transcript's metadata in an XML document. This also copies the artificial reading texts. -->
<f:list-transcripts name="transcripts">
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</f:list-transcripts>
<!-- We need to save it now, its referenced later. -->
<l:store name="save-transcripts">
<p:with-option name="href" select="resolve-uri('faust-transcripts.xml', $builddir)"/>
</l:store>
<!-- ## Step 1.5: Lesetext -->
<f:generate-reading-text name="generate-reading-text"/>
<!-- ############ STEP 2: Enhance all transcripts with metadata -->
<f:generate-search name="generate-search">
<p:input port="source"><p:pipe port="result" step="save-transcripts"/></p:input>
</f:generate-search>
<!-- TODO this by side-effect also collects the bargraph information -->
<cx:message message="Creating emended versions ..."/>
<!-- ############ STEP 3: Create the emended version -->
<p:for-each name="apply-edits">
<p:iteration-source select="//f:textTranscript"/>
<p:variable name="transcriptFile" select="/f:textTranscript/@href"/>
<p:variable name="transcriptURI" select="/f:textTranscript/@uri"/>
<p:variable name="documentURI" select="/f:textTranscript/@document"/>
<p:variable name="type" select="/f:textTranscript/@type"/>
<p:variable name="sigil" select="/f:textTranscript/f:idno[1]/text()"/>
<p:variable name="sigil_t" select="/f:textTranscript/@sigil_t"/>
<p:load name="load-in-apply-edits">
<p:with-option name="href" select="resolve-uri(concat('prepared/textTranscript/', $sigil_t, '.xml'), $builddir)"></p:with-option>
</p:load>
<p:choose>
<p:when test="$type = 'lesetext'">
<p:xslt>
<p:input port="stylesheet"><p:document href="xslt/prose-to-lines.xsl"/></p:input>
</p:xslt>
</p:when>
<p:otherwise>
<!--<cx:message><p:with-option name="message" select="concat('Emending ', $sigil, ' (', $documentURI, ') ...')"/></cx:message>-->
<f:apply-edits/>
</p:otherwise>
</p:choose>
<p:store>
<p:with-option name="href" select="resolve-uri(concat('emended/', $sigil_t, '.xml'), $builddir)"/>
</p:store>
<!-- Grundschicht -->
<p:xslt>
<p:input port="source"><p:pipe port="result" step="load-in-apply-edits"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/normalize-wsp.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</p:xslt>
<p:xslt name="text-unemend">
<p:input port="stylesheet"><p:document href="xslt/text-unemend.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</p:xslt>
<p:xslt>
<p:input port="stylesheet"><p:document href="xslt/unemend-core.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</p:xslt>
<p:xslt>
<p:input port="stylesheet"><p:document href="xslt/changenote.xsl"/></p:input>
<p:with-param name="changenote" select="'Base layer without instant revisions'"/>
</p:xslt>
<p:store indent="true">
<p:with-option name="href" select="resolve-uri(concat('grundschicht/', $sigil_t, '.xml'), $builddir)"/>
</p:store>
<p:xslt>
<p:input port="source"><p:pipe port="result" step="text-unemend"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/emend-core-only-instant.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</p:xslt>
<p:xslt>
<p:input port="stylesheet"><p:document href="xslt/changenote.xsl"/></p:input>
<p:with-param name="changenote" select="'Base layer plus instant revisions'"/>
</p:xslt>
<p:store indent="true">
<p:with-option name="href" select="resolve-uri(concat('grundschicht-instant/', $sigil_t, '.xml'), $builddir)"/>
</p:store>
</p:for-each>
<!-- Pipe through list of inputs -->
<p:identity name="emended-version"><p:input port="source"><p:pipe port="result" step="generate-search"/></p:input></p:identity>
<!-- ############## STEP 4: Creating the variant apparatus -->
<f:collate-variants name="collate-variants"/>
<!-- ############## STEP 5a: Creating the print versions -->
<f:generate-print name="generate-print"/>
<!-- ############################################################################## -->
<!-- The following steps don't depend on the full workflow, but rather only on parts. -->
<!-- ### Step 1a: scene line mapping -->
<p:xslt>
<p:input port="source"><p:document href="xslt/scenes.xml"></p:document></p:input>
<p:input port="stylesheet"><p:document href="xslt/scene-line-mapping.xsl"></p:document></p:input>
</p:xslt>
<p:store method="text" encoding="utf-8">
<p:with-option name="href" select="resolve-uri('www/data/scene_line_mapping.js', resolve-uri($builddir))"/>
</p:store>
<!-- ### Step 3a: Inline Apparatus -->
<f:generate-app>
<p:input port="source"><p:pipe port="result" step="generate-search"></p:pipe></p:input>
</f:generate-app>
<!-- ### Step 3b: pages.json -->
<p:identity><p:input port="source"><p:pipe port="result" step="save-transcripts"></p:pipe></p:input></p:identity>
<p:for-each>
<p:iteration-source select="//f:textTranscript"/>
<p:variable name="sigil_t" select="/f:textTranscript/@sigil_t"/>
<p:load>
<p:with-option name="href" select="resolve-uri(concat('prepared/textTranscript/', $sigil_t, '.xml'), $builddir)"/>
</p:load>
</p:for-each>
<p:xslt template-name="collection">
<p:input port="parameters"><p:pipe port="result" step="config"></p:pipe></p:input>
<p:input port="stylesheet"><p:document href="xslt/pagelist.xsl"/></p:input>
</p:xslt>
<p:store method="text" media-type="application/json">
<p:with-option name="href" select="resolve-uri('pages.json', resolve-uri($html))"/>
</p:store>
<!-- ### Step 3c: Reading text apparatus list -->
<p:xslt name="reading-text-md">
<p:input port="source"><p:pipe port="result" step="generate-reading-text"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/add-metadata.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
<p:with-param name="type" select="'lesetext'"/>
</p:xslt>
<p:xslt>
<p:input port="stylesheet"><p:document href="xslt/text-applist.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('www/print/app.html', $builddir)"/>
</p:store>
<p:store>
<p:input port="source"><p:pipe port="result" step="reading-text-md"/></p:input>
<p:with-option name="href" select="resolve-uri('lesetext/faust-md.xml', $builddir)"/>
</p:store>
<!-- ### Step 3c': Reading text apparatus reflist -->
<p:xslt>
<p:input port="source"><p:pipe port="result" step="reading-text-md"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/text-applist.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
<p:with-param name="output-type" select="'reflist'"></p:with-param>
</p:xslt>
<p:store method="xhtml">
<p:with-option name="href" select="resolve-uri('www/print/reflist.html', $builddir)"/>
</p:store>
<!-- ### Step 3d: Reading text word index -->
<p:xslt>
<p:input port="source"><p:pipe port="result" step="reading-text-md"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/word-index.xsl"></p:document></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"></p:pipe></p:input>
<p:with-param name="limit" select="0"/>
<p:with-param name="title" select="'Tokens im Lesetext'"/>
</p:xslt>
<p:store method="xhtml">
<p:with-option name="href" select="resolve-uri('www/print/faust.wordlist.html', $builddir)"/>
</p:store>
<!-- ### Step 3b: Metadata HTML -->
<f:metadata-html name="metadata-html">
<p:input port="source"><p:pipe port="result" step="generate-search"></p:pipe></p:input>
</f:metadata-html>
<!-- ### Step 2b: Metadaten nach JSON -->
<f:metadata-js>
<p:input port="source"><p:pipe port="result" step="save-transcripts"></p:pipe></p:input>
</f:metadata-js>
<!-- ## Step 2c: prints index -->
<p:xslt>
<p:input port="source"><p:pipe port="result" step="save-transcripts"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
<p:input port="stylesheet"><p:document href="xslt/prints-index.xsl"/></p:input>
</p:xslt>
<p:store method="xhtml" indent="true">
<p:with-option name="href" select="resolve-uri('www/archive_prints.html', $builddir)"/>
</p:store>
<!-- ## Step 2d: testimony -->
<f:testimony name="testimony">
<p:input port="source"><p:pipe port="result" step="save-transcripts"></p:pipe></p:input>
</f:testimony>
<!-- ## Step 2e: Redirect-Tabellen für /print /meta /app -->
<p:xslt>
<p:input port="source"><p:pipe port="result" step="save-transcripts"></p:pipe></p:input>
<p:input port="stylesheet"><p:document href="xslt/generate-htaccess.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
<p:with-param name="rewrite-base" select="'/print'"/>
<p:with-param name="old-source" select="'texttranscript'"/>
</p:xslt>
<p:store method="text"><p:with-option name="href" select="resolve-uri('www/print/.htaccess', $builddir)"/></p:store>
<p:xslt>
<p:input port="source"><p:pipe port="result" step="save-transcripts"></p:pipe></p:input>
<p:input port="stylesheet"><p:document href="xslt/generate-htaccess.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
<p:with-param name="rewrite-base" select="'/app'"/>
<p:with-param name="old-source" select="'texttranscript'"/>
</p:xslt>
<p:store method="text"><p:with-option name="href" select="resolve-uri('www/app/.htaccess', $builddir)"/></p:store>
<p:xslt>
<p:input port="source"><p:pipe port="result" step="save-transcripts"></p:pipe></p:input>
<p:input port="stylesheet"><p:document href="xslt/generate-htaccess.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
<p:with-param name="rewrite-base" select="'/meta'"/>
<p:with-param name="old-source" select="'document'"/>
</p:xslt>
<p:store method="text"><p:with-option name="href" select="resolve-uri('www/meta/.htaccess', $builddir)"/></p:store>
<!-- ## Step 3a: bibliography -->
<p:xslt name="reading-text-citations">
<p:input port="source"><p:pipe port="result" step="reading-text-md"></p:pipe></p:input>
<p:input port="stylesheet"><p:document href="xslt/text-extract-citations.xsl"/></p:input>
<p:input port="parameters"><p:pipe port="result" step="config"/></p:input>
</p:xslt>
<f:bibliography>
<p:input port="source">
<p:pipe port="result" step="metadata-html"/>
<p:pipe port="result" step="testimony"/>
<p:pipe port="result" step="reading-text-citations"/>
</p:input>
</f:bibliography>
<!-- ### Step 4a: Paralipomena-Tabelle -->
<f:generate-para-table>
<p:input port="source">
<p:pipe port="result" step="emended-version"/>
</p:input>
</f:generate-para-table>
<!-- ### Step XXX: Wortindex -->
<p:for-each>
<p:iteration-source select="//f:textTranscript">
<p:pipe port="result" step="emended-version"/>
</p:iteration-source>
<p:variable name="sigil_t" select="/f:textTranscript/@sigil_t"/>
<p:load>
<p:with-option name="href" select="resolve-uri(concat('emended/', $sigil_t, '.xml'), $builddir)"/>
</p:load>
</p:for-each>
<p:wrap-sequence wrapper="doc" name="wrap-emended"/>
<p:xslt>
<p:input port="stylesheet"><p:document href="xslt/word-index.xsl"/></p:input>
</p:xslt>
<p:store method="xhtml" indent="true">
<p:with-option name="href" select="resolve-uri('www/word-index.html', $builddir)"/>
</p:store>
<p:store method="xhtml" indent="true">
<p:with-option name="href" select="resolve-uri('emended-texts.xml', $builddir)"/>
<p:input port="source"><p:pipe port="result" step="wrap-emended"></p:pipe></p:input>
</p:store>
</p:group>
<!--<p:sink/>-->
</p:declare-step>