-
Notifications
You must be signed in to change notification settings - Fork 0
/
validate-all.xpl
132 lines (113 loc) · 5.83 KB
/
validate-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
<?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:f="http://www.faustedition.net/ns"
xmlns:pxf="http://exproc.org/proposed/steps/file"
xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
xmlns:l="http://xproc.org/library" type="f:validate-all" name="main" version="1.0">
<p:option name="target" select="'../../../target/'"/>
<p:option name="_target" select="resolve-uri($target)"/>
<p:option name="xml" select="'../../../data/xml/'"></p:option>
<p:option name="_xml" select="resolve-uri($xml)"/>
<p:input port="source"><p:empty/></p:input>
<p:input port="parameters" kind="parameter"/>
<p:output port="result" primary="true" sequence="true"><p:empty/></p:output>
<p:serialization port="result" indent="true"/>
<p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
<p:import href="validate-xml.xpl"/>
<p:group name="validations">
<f:validate-xmls report-name="metadata" report-title="Metadata (Transcripts)">
<p:with-option name="target" select="$_target"/>
<p:with-option name="xmlroot" select="resolve-uri('document', $_xml)"/>
<p:with-option name="xsd" select="resolve-uri('schema/metadata.xsd', $_target)"/>
<p:with-option name="exclude-filter" select="'print'"/>
<p:with-option name="linkroot" select="'https://faustedition.uni-wuerzburg.de/xml/document/'"/>
</f:validate-xmls>
<f:validate-xmls report-name="metadata_print" report-title="Metadata (Prints)">
<p:with-option name="target" select="$_target"/>
<p:with-option name="xmlroot" select="resolve-uri('document/print', $_xml)"/>
<p:with-option name="xsd" select="resolve-uri('schema/metadata_print.xsd', $_target)"/>
<p:with-option name="linkroot" select="'https://faustedition.uni-wuerzburg.de/xml/document/print/'"/>
</f:validate-xmls>
<f:validate-xmls report-name="macrogenesis" report-title="Macrogenesis Data">
<p:with-option name="target" select="$_target"/>
<p:with-option name="xmlroot" select="resolve-uri('macrogenesis', $_xml)"/>
<p:with-option name="xsd" select="resolve-uri('schema/macrogenesis.xsd', $_target)"/> <!-- TODO -->
<p:with-option name="linkroot" select="'https://faustedition.uni-wuerzburg.de/xml/macrogenesis/'"/>
</f:validate-xmls>
<f:validate-xmls report-name="faust-tei" report-title="Converted Transcripts (faust-tei)">
<p:with-option name="target" select="$_target"/>
<p:with-option name="xmlroot" select="p:resolve-uri('converted', $_target)"/>
<p:with-option name="rng" select="resolve-uri('schema/faust-tei.rng', $_target)"/>
<p:with-option name="schematron" select="resolve-uri('schema/faust-tei.sch', $_target)"/>
<p:with-option name="linkroot" select="'https://faustedition.uni-wuerzburg.de/xml/transcript/'"/>
</f:validate-xmls>
<f:validate-xmls report-name="printed_editions_neu" report-title="Printed Editions Neu (printed_editions_neu)">
<p:with-option name="target" select="$_target"/>
<p:with-option name="xmlroot" select="concat($xml, 'print')"/>
<p:with-option name="rng" select="resolve-uri('schema/printed_editions_neu.rng', $_target)"/>
<p:with-option name="schematron" select="resolve-uri('schema/printed_editions_neu.sch', $_target)"/>
<p:with-option name="linkroot" select="'https://faustedition.uni-wuerzburg.de/xml/print/'"/>
</f:validate-xmls>
</p:group>
<cx:message>
<p:with-option name="message" select="concat('Loading reports from ', resolve-uri('report', $_target))"/>
</cx:message>
<p:directory-list include-filter=".*\.html$">
<p:with-option name="path" select="resolve-uri('report', $_target)"/>
</p:directory-list>
<p:for-each name="load-reports">
<p:iteration-source select="//c:file"/>
<p:variable name="report-uri" select="resolve-uri(/c:file/@name, resolve-uri('report/', $_target))"/>
<cx:message>
<p:with-option name="message" select="concat('Loading report ', $report-uri)"/>
</cx:message>
<p:try>
<p:group>
<p:load>
<p:with-option name="href" select="$report-uri"/>
</p:load>
</p:group>
<p:catch name="catch-load-report">
<cx:message>
<p:with-option name="message" select="concat('Failed to load ', $report-uri, ': ', .)"/>
<p:input port="source"><p:pipe port="error" step="catch-load-report"/></p:input>
</cx:message>
<p:identity><p:input port="source"><p:empty/></p:input></p:identity>
</p:catch>
</p:try>
</p:for-each>
<p:xslt template-name="start" name="index-html">
<p:input port="stylesheet">
<p:document href="validation-summary.xsl"/>
</p:input>
</p:xslt>
<p:store method="xhtml" indent="true">
<p:with-option name="href" select="resolve-uri('report/index.html', $_target)"/>
</p:store>
<p:directory-list include-filter=".*\.xml$">
<p:with-option name="path" select="resolve-uri('report', $_target)"/>
</p:directory-list>
<p:for-each>
<p:iteration-source select="//c:file"/>
<p:variable name="report-uri" select="resolve-uri(/c:file/@name, resolve-uri('report/', $_target))"/>
<cx:message>
<p:with-option name="message" select="concat('Annotating XMLs for ', $report-uri)"/>
</cx:message>
<p:try>
<p:group>
<p:exec command="src/main/tools/highlight-errors.py" source-is-xml="true" errors-is-xml="false" result-is-xml="false">
<p:with-option name="args" select="string-join(('-s1', '-o', resolve-uri('report/', $_target), $report-uri), ' ')"/>
<p:input port="source"><p:empty/></p:input>
</p:exec>
</p:group>
<p:catch name="catch-ann-xml">
<cx:message>
<p:with-option name="message" select="concat('Failed to load ', $report-uri, ': ', .)"/>
<p:input port="source"><p:pipe port="error" step="catch-ann-xml"/></p:input>
</cx:message>
<p:identity><p:input port="source"><p:empty/></p:input></p:identity>
</p:catch>
</p:try>
</p:for-each>
<p:sink/>
</p:declare-step>