forked from faustedition/faust-gen-html
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-reading-text.xpl
151 lines (121 loc) · 5.08 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
<?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:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
<p:import href="http://xproc.org/library/store.xpl"/>
<p:import href="preprocess-reading-text-sources.xpl"/>
<!-- Parameter laden -->
<p:parameters name="config">
<p:input port="parameters">
<p:document href="config.xml"/>
<p:pipe port="parameters" step="main"/>
</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>
<p:for-each>
<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: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>
<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:xslt>
<!-- Generate a list of interesting elements with context and store as XML and HTML -->
<p:xslt name="issue-178-list">
<p:input port="source"><p:pipe port="result" step="assemble"/></p:input>
<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="app"/></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>
<!-- 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" indent="true">
<p:input port="source"><p:pipe port="result" step="app"/></p:input>
<p:with-option name="href" select="resolve-uri('lesetext/faust.xml', $builddir)"/>
</p:store>
<!-- additionally, pass out the real result -->
<p:identity><p:input port="source"><p:pipe port="result" step="app"/></p:input></p:identity>
</p:group>
</p:declare-step>