-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.xhtml
243 lines (234 loc) · 9.29 KB
/
index.xhtml
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
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="yes"?>
<?css-conversion no?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:s="tag:conaltuohy.com,2017:xforms-serialization"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<title>Muscovy ODD editor</title>
<link href="https://fonts.googleapis.com/css?family=Uncial+Antiqua" rel="stylesheet"/>
<style type="text/css">
@namespace xf url("http://www.w3.org/2002/xforms");
body {font-family: Helvetica, sans-serif}
h1 {
font-size: 32pt;
font-family: "Uncial Antiqua", serif;
font-weight: normal;
}
h2, h3 {
font-family: sans-serif;
}
div.header {
margin-left: auto;
margin-right: auto;
text-align: center;
}
img.logo {
width: 4em;
}
</style>
<xf:model>
<xf:instance id="current-module" xmlns="">
<current-module/>
</xf:instance>
<!-- TEI P5 -->
<!--
BUG: @src here does not work; attempts to load data as JSON-P, but of course it's XML so it doesn't parse as JSON
<xf:instance id="p5-subset" src="http://www.tei-c.org/release/xml/tei/odd/p5subset.xml"/>
-->
<!-- the following, which should be equivalent, does work, by simply performing a GET and relying on CORS -->
<xf:send ev:event="xforms-model-construct-done" submission="load-p5-subset"/>
<xf:submission id="load-p5-subset"
resource="http://www.tei-c.org/release/xml/tei/odd/p5subset.xml"
method="get"
replace="instance"
instance="p5-subset"
>
<xf:insert id="list-modules"
ev:event="xforms-submit-done"
origin="instance('p5-subset')/tei:text/tei:body/tei:div/tei:div/tei:moduleSpec"
context="instance('modules')"
/>
</xf:submission>
<xf:instance id="p5-subset" xmlns="">
<dummy/>
</xf:instance>
<xf:instance id="modules" xmlns="">
<modules/>
</xf:instance>
<!-- the list of external ODD templates -->
<!-- TODO provide a list of ODDs as starting points
<xf:instance id="templates">
<ul xml:base="http://www.tei-c.org/release/xml/tei/custom/odd/">
<li>
<a href="tei_all.odd">TEI All</a>
</li>
<li>
<a href="tei_lite.odd">TEI Lite</a>
</li>
</ul>
</xf:instance>
-->
<xf:instance id="compiled-odd">
<dummy/>
</xf:instance>
<!-- the user's ODD -->
<xf:instance id="odd">
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:lang="en">
<teiHeader>
<fileDesc>
<titleStmt>
<title>My TEI Extension</title>
<author>generated by Muscovy</author>
</titleStmt>
<publicationStmt>
<p>for use by whoever wants it</p>
</publicationStmt>
<sourceDesc>
<p>created using Muscovy</p>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<front>
<divGen type="toc"/>
</front>
<body>
<p>My TEI Customization
starts with modules tei, core, textstructure and header</p>
<schemaSpec ident="myTEI" docLang="en" prefix="tei_" xml:lang="en">
<moduleRef key="core" except=""/>
<moduleRef key="tei" except=""/>
<moduleRef key="header" except=""/>
<moduleRef key="textstructure" except=""/>
</schemaSpec>
</body>
</text>
</TEI>
</xf:instance>
<xf:instance id="conversion-request" xmlns="">
<!-- used for OxGarage conversions -->
<ege-webservice-call>
<input/>
<filename>file</filename>
</ege-webservice-call>
</xf:instance>
<xf:instance id="uploaded-odd" xmlns="">
<ege-webservice-call>
<fileToConvert xsi:type="xsd:anyURI"/>
</ege-webservice-call>
</xf:instance>
<xf:instance id="http-response" xmlns="">
<http-response>
<response-headers/>
</http-response>
</xf:instance>
<xf:submission
id="upload-user-odd"
resource="http://www.tei-c.org/ege-webservice/Conversions/TEI%3Atext%3Axml/xml%3Aapplication%3Axml/conversion?properties=%3Cconversions%3E%3Cconversion%20index=%220%22%3E%3Cproperty%20id=%22oxgarage.getImages%22%3Efalse%3C/property%3E%3Cproperty%20id=%22oxgarage.getOnlineImages%22%3Efalse%3C/property%3E%3Cproperty%20id=%22oxgarage.lang%22%3Een%3C/property%3E%3Cproperty%20id=%22oxgarage.textOnly%22%3Efalse%3C/property%3E%3Cproperty%20id=%22pl.psnc.dl.ege.tei.profileNames%22%3Edefault%3C/property%3E%3C/conversion%3E%3C/conversions%3E"
method="form-data-post"
ref="instance('uploaded-odd')"
replace="instance"
instance="odd"
omit-xml-declaration="true"
>
<!-- need to store the "event('response-headers')" data in an instance in order to parse it (TODO document this xsltforms limitation) -->
<xf:insert ev:event="xforms-submit-done"
context="instance('http-response')/response-headers"
nodeset="*"
origin="event('response-headers')"/>
<xf:setvalue ev:event="xforms-submit-done"
ref="instance('conversion-request')/filename"
value="
choose(
instance('http-response')/response-headers/header[name='Content-Disposition']/value,
normalize-space(
replace(
instance('http-response')/response-headers/header[name='Content-Disposition']/value,
'attachment; filename="([^"]+)"',
'$1'
)
),
'myODD'
)
"
/>
<xf:setvalue ev:event="xforms-submit-done" ref="instance('conversion-request')/input" value="serialize(instance('odd'))"/>
<xf:send ev:event="xforms-submit-done" submission="compile-odd"/>
</xf:submission>
<xf:submission
id="compile-odd"
resource="http://www.tei-c.org/ege-webservice/Conversions/ODD%3Atext%3Axml/ODDC%3Atext%3Axml/"
method="urlencoded-post"
ref="instance('conversion-request')"
replace="instance"
instance="compiled-odd"
/>
<xf:submission
id="request-relaxng-schema"
resource="http://www.tei-c.org/ege-webservice/Conversions/ODD%3Atext%3Axml/ODDC%3Atext%3Axml/relaxng%3Aapplication%3Axml-relaxng/"
method="urlencoded-post"
ref="instance('conversion-request')"
replace="all"
show="download"
/>
<xf:submission
id="save-odd"
resource="http://www.tei-c.org/ege-webservice/Conversions/TEI%3Atext%3Axml/xml%3Aapplication%3Axml/"
method="urlencoded-post"
ref="instance('conversion-request')"
replace="all"
show="download"
/>
</xf:model>
</head>
<body>
<div class="header">
<h1><img class="logo" src="https://upload.wikimedia.org/wikipedia/commons/2/25/Seal-of-Ivan-4_1539_a.svg" alt="Byzantine imperial eagle of Muscovy"/><br/>Muscovy</h1>
<h2>TEI Schema Editor</h2>
</div>
<xf:upload ref="instance('uploaded-odd')/fileToConvert" mediatype="application/xml" incremental="true">
<xf:label>Upload existing ODD</xf:label>
<!-- TODO xsltforms bug: DOMActivate event occurs upon clicking the upload button, but not after file selection is made.
"See https://www.w3.org/TR/xforms11/#sequence-for-input for details:
When the user activates the control and the value has changed, then, after the new value is placed into the bound instance node, the event sequence consists of the events described at 4.6.7 Sequence: Value Change followed by dispatching the DOMActivate event"
-->
<xf:send ev:event="xforms-value-changed" submission="upload-user-odd"/>
</xf:upload>
<xf:trigger>
<xf:label>Get RelaxNG schema</xf:label>
<!-- set up the OxGarage conversion request: serialize the ODD into OxGarage's "input" parameter -->
<xf:setvalue ev:event="DOMActivate" ref="instance('conversion-request')/input" value="serialize(instance('odd'))"/>
<!-- issue the request to OxGarage -->
<xf:send ev:event="DOMActivate" submission="request-relaxng-schema"/>
</xf:trigger>
<xf:trigger>
<xf:label>Save ODD</xf:label>
<!-- set up the OxGarage conversion request: serialize the ODD into OxGarage's "input" parameter -->
<xf:setvalue ev:event="DOMActivate" ref="instance('conversion-request')/input" value="serialize(instance('odd'))"/>
<!-- issue the request to OxGarage -->
<xf:send ev:event="DOMActivate" submission="save-odd"/>
</xf:trigger>
<xf:output id="p5-version" ref="instance('p5-subset')/tei:teiHeader/tei:fileDesc/tei:editionStmt">
<xf:label>TEI version: </xf:label>
</xf:output>
<xf:repeat id="module" nodeset="instance('modules')/tei:moduleSpec">
<xf:trigger ref=".">
<xf:label><xf:output ref="tei:altIdent"/></xf:label>
</xf:trigger>
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="instance('current-module')" value="instance('modules')/tei:moduleSpec[index('module')]/@ident"/>
</xf:action>
</xf:repeat>
<xf:group id="module-pane" ref="instance('modules')/tei:moduleSpec[@ident = string(instance('current-module'))]">
<xf:output value="tei:altIdent">
<xf:label>Module: </xf:label>
</xf:output>
</xf:group>
</body>
</html>