-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathw3x.xml
245 lines (233 loc) · 10.4 KB
/
w3x.xml
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
<?xml
version="1.0"
encoding="UTF-8"?>
<?xml-stylesheet
href="xsltforms-1.7/xsltforms.xsl"
type="text/xsl"?>
<?xsltforms-options
debug="no"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ht="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xlink="http://www.w3.org/1999/xlink"
lang="en">
<head>
<meta
charset="utf-8"/>
<meta
name="viewport"
content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/>
<style type="text/css">
<![CDATA[
#r_employees > xforms-repeat-item[xf-selected='false'] { filter: brightness(0.6); }
]]>
</style>
<xf:model id="model">
<xf:instance id="app">
<app xmlns="">
<sidebar state="false" display=""/>
<theme/>
<link xlink:type="simple" xlink:title="XForms" xlink:href="https://en.wikipedia.org/wiki/XForms" />
<link xlink:type="simple" xlink:title="W3 CSS" xlink:href="https://www.w3schools.com/w3css/" />
<link xlink:type="simple" xlink:title="XSLTForms 1.7" xlink:href="https://github.com/AlainCouthures/declarative4all/releases/tag/XSLTForms"/>
<link xlink:type="simple" xlink:title="XForms 2.0" xlink:href="https://www.w3.org/community/xformsusers/wiki/XForms_2.0"/>
<images baseurl="https://www.w3schools.com/w3css/">
<link xlink:type="simple" xlink:href="img_avatar1.png"/>
<link xlink:type="simple" xlink:href="img_avatar2.png"/>
<link xlink:type="simple" xlink:href="img_avatar3.png"/>
<link xlink:type="simple" xlink:href="img_avatar4.png"/>
<link xlink:type="simple" xlink:href="img_avatar5.png"/>
<link xlink:type="simple" xlink:href="img_avatar6.png"/>
</images>
<!-- A list of w3.css themes. See: https://www.w3schools.com/w3css/w3css_color_themes.asp -->
<themes xmlns:xlink="http://www.w3.org/1999/xlink">
<theme xlink:type="simple" xlink:href="w3-theme-red.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-pink.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-purple.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-deep-purple.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-indigo.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-blue.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-light-blue.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-cyan.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-teal.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-green.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-light-green.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-lime.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-khaki.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-yellow.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-amber.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-orange.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-deep-orange.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-blue-grey.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-brown.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-grey.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-dark-grey.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-black.css"/>
<theme xlink:type="simple" xlink:href="w3-theme-w3schools.css"/>
</themes>
</app>
</xf:instance>
<xf:bind ref="sidebar/@state" type="xs:boolean"/>
<xf:bind ref="sidebar/@display" calculate="choose(../@state=true(), 'block', 'none')"/>
<xf:instance id="employees">
<employees xmlns="">
<employee name="name" role="role" img="" template="true"/>
<employee name="Mike" role="Web Designer" img="img_avatar2.png"/>
<employee name="Jill" role="Support" img="img_avatar5.png"/>
<employee name="Jane" role="Accountant" img="img_avatar6.png"/>
</employees>
</xf:instance>
<xf:bind ref="instance('employees')/employee">
<xf:bind ref="@template" type="xs:boolean" readonly=".=true()"/>
<xf:bind ref="@name" required="true()"/>
<xf:bind ref="@role" required="true()"/>
</xf:bind>
<xf:action ev:event="xforms-ready">
<xf:setvalue ref="instance('employees')/employee[@template=true()]/@img" value="instance('app')/images/link[1]/@xlink:href"/>
<xf:setvalue ref="instance('app')/theme[@template=true()]/@img" value="instance('app')/images/link[1]/@xlink:href"/>
<xf:setvalue ref="instance('app')/theme" value="instance('app')/themes/theme[1]/@xlink:href"/>
</xf:action>
<xf:submission id="s_dummy" action="javascript:null" method="post" replace="none">
<xf:action ev:event="xforms-submit">
<xf:message>DUMMY SUBMISSION</xf:message>
</xf:action>
</xf:submission>
</xf:model>
</head>
<body class="w3-theme-dark">
<link rel="stylesheet" href="https://www.w3schools.com/lib/{instance('app')/theme}"/>
<div class="w3-bar w3-card w3-theme">
<xf:trigger appearance="minimal">
<xf:label class="w3-button w3-theme w3-xlarge">☰</xf:label>
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="sidebar/@state" value="choose(.=true(), false(), true())"/>
</xf:action>
</xf:trigger>
<div class="w3-container" style="display: inline-block">
<h1>Using XForms and W3 CSS together</h1>
</div>
</div>
<div class="w3-row">
<div class="w3-col l1 w3-sidebar w3-bar-block w3-border-right w3-animate-left" style="display: {sidebar/@display}" id="sidebar">
<xf:group ref="instance('app')">
<xf:trigger appearance="minimal">
<xf:label class="w3-theme-l1"><xf:output ref="theme"/></xf:label>
<xf:hint class="w3-theme-light">Click to change theme</xf:hint>
<xf:setvalue
ev:event="DOMActivate"
ref="theme"
value="choose(
boolean(../themes/theme[@xlink:href=../../theme]/following-sibling::theme),
../themes/theme[@xlink:href=../../theme]/following-sibling::theme/@xlink:href,
../themes/theme[1]/@xlink:href)"/>
</xf:trigger>
<h3 class="w3-theme-dark">Links:</h3>
<xf:repeat ref="link" id="r_links">
<xf:trigger appearance="minimal">
<xf:label ref="@xlink:title"/>
<xf:load ev:event="DOMActivate" show="new"> <!-- XSLT 1.7 doesn't seem to understand the 'resource' attribute, using the deprecated child element version instead -->
<xf:resource value="@xlink:href"/>
</xf:load>
</xf:trigger>
</xf:repeat>
</xf:group>
</div>
<p>
This page combines XForms and W3 CSS. It uses XSLT 1.7 as the XForms engine.
</p>
<p>
XSLTForms 1.7 has some features from V2.0 of XForms (for instance AVT, Dialogs)
</p>
<div class="w3-container w3-col l11" id="content">
<xf:trigger appearance="minimal">
<xf:label class="w3-bat-item w3-button w3-theme w3-large"><i class="material-icons">add</i></xf:label>
<xf:hint class="w3-theme-light">New Employee</xf:hint>
<xf:action ev:event="DOMActivate">
<xf:insert ref="instance('employees')/employee" origin="instance('employees')/employee[@template=true()]"/>
<xf:setvalue ref="instance('employees')/employee[last()]/@template" value="false()"/>
<xf:refresh/>
<xf:setindex repeat="r_employees" index="1+count(instance('employees')/employee[not(@template=true())])"/>
<xf:show dialog="card"/>
</xf:action>
</xf:trigger>
<xf:trigger appearance="minimal">
<xf:label class="w3-bat-item w3-button w3-theme w3-large"><i class="material-icons">save</i></xf:label>
<xf:hint class="w3-theme-light">Save List</xf:hint>
<xf:send ev:event="DOMActivate" submission="s_dummy"/>
</xf:trigger>
<ul class="w3-ul w3-card-4">
<xf:repeat ref="instance('employees')/employee[not(@template=true())]" id="r_employees">
<li class="w3-bar">
<div class="w3-bar-item w3-right">
<xf:trigger appearance="minimal">
<xf:label class="w3-button w3-theme w3-large"><i class="material-icons">edit</i></xf:label>
<xf:hint class="w3-theme-light">Edit Employee</xf:hint>
<xf:action ev:event="DOMActivate">
<xf:show dialog="card"/>
</xf:action>
</xf:trigger>
<xf:trigger appearance="minimal">
<xf:label class="w3-button w3-theme w3-large w3-margin-left"><i class="material-icons">delete</i></xf:label>
<xf:hint class="w3-theme-light">Delete Employee</xf:hint>
<xf:delete ev:event="DOMActivate" ref="."/>
</xf:trigger>
</div>
<img src="{concat(instance('app')/images/@baseurl, @img)}" class="w3-bar-item w3-circle w3-hide-small" style="width:85px"/>
<div class="w3-bar-item">
<span class="w3-large"><xf:output ref="@name"/></span><br/>
<span><xf:output ref="@role"/></span>
</div>
</li>
</xf:repeat>
</ul>
</div>
</div>
<xf:dialog id="card" style="height:400px">
<xf:group ref="instance('employees')/employee[1+index('r_employees')]">
<div class="w3-card-4 w3-theme">
<div class="w3-theme-dark w3-bar-item">
<h3 class="w3-theme-dark w3-center">Employee Details</h3>
</div>
<div class="w3-container w3-center">
<xf:trigger appearance="minimal">
<xf:hint class="w3-theme-light">Click to change image</xf:hint>
<xf:setvalue
ev:event="DOMActivate"
ref="@img"
value="choose(
boolean(instance('app')/images/link[@xlink:href=context()/@img]/following-sibling::link),
instance('app')/images/link[@xlink:href=context()/@img]/following-sibling::link/@xlink:href,
instance('app')/images/link[1]/@xlink:href)"/>
<img src="{concat(instance('app')/images/@baseurl, @img )}" class="w3-bar-item w3-circle w3-hide-small" style="width:85px"/>
</xf:trigger>
<div class="w3-bar-item">
<span class="w3-large">
<xf:input placeholder="..." ref="@name" incremental="true">
<xf:label>Name</xf:label>
</xf:input>
</span><br/>
<span class="w3-large">
<xf:input ref="@role" incremental="true">
<xf:label>Role</xf:label>
</xf:input>
</span>
</div>
<div class="w3-panel w3-theme-light">
<xf:trigger class="w3-centre w3-button" appearance="minimal">
<xf:label>Done</xf:label>
<xf:hint class="w3-theme-light">Click to close dialog</xf:hint>
<xf:action ev:event="DOMActivate">
<xf:hide dialog="card" ev:event="DOMActivate"/>
</xf:action>
</xf:trigger>
</div>
</div>
</div>
</xf:group>
</xf:dialog>
</body>
</html>