-
Notifications
You must be signed in to change notification settings - Fork 0
/
resize.xml
167 lines (154 loc) · 7.09 KB
/
resize.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
<?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>
<title>XFORMS + W3.CSS</title>
<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>
<![CDATA[
a:hover { text-decoration: underline }
]]>
</style>
<xf:model id="model">
<xf:instance id="app">
<app xmlns="">
<sidebar state="false" display="" maindisplay="" navdisplay=""/>
<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"/>
<link
xlink:type="simple"
xlink:title="Slide the Page Content to the Right"
xlink:href="https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_sidebar_shift"/>
<images baseurl="https://www.w3schools.com/w3css/">
<link xlink:type="simple" xlink:title="car" xlink:href="img_car.jpg"/>
</images>
<!-- A list of w3.css themes. See: https://www.w3schools.com/w3css/w3css_color_themes.asp -->
<themes baseurl="https://www.w3schools.com/lib/">
<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>
<icon id="i_expand">menu</icon>
<icon id="i_collapse">close</icon>
<icon id="i_theme">palette</icon>
</app>
</xf:instance>
<xf:bind ref="instance('app')">
<xf:bind ref="sidebar/@state" type="xs:boolean"/>
<xf:bind ref="sidebar/@display"
calculate="choose(../@state=true(), 'display: block; width : 25%;', 'display: none')"/>
<xf:bind ref="sidebar/@maindisplay"
calculate="choose(../@state=true(), 'margin-left: 25%;', 'margin-left: 0%;')"/>
<xf:bind ref="sidebar/@navdisplay"
calculate="choose(../@state=true(), 'display: none', 'display: inline-block')"/>
</xf:bind>
<xf:action ev:event="xforms-ready">
<xf:setvalue ref="instance('app')/sidebar" value="false()"/>
<xf:setvalue ref="instance('app')/theme" value="../themes/theme[@xlink:href='w3-theme-teal.css']/@xlink:href"/>
</xf:action>
</xf:model>
</head>
<body>
<xf:group ref="instance('app')">
<link rel="stylesheet" href="{concat(themes/@baseurl,theme)}"/>
<div class="w3-sidebar w3-bar-block w3-card w3-animate-left w3-theme-l3" style="{sidebar/@display}" id="mySidebar">
<xf:trigger appearance="minimal" class="w3-button w3-large material-icons">
<xf:label ref="icon[@id='i_collapse']" class="w3-theme"/>
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="sidebar/@state" value="false()"/>
</xf:action>
</xf:trigger>
<xf:trigger appearance="minimal" class="w3-button w3-large material-icons">
<xf:label ref="icon[@id='i_theme']" class="w3-theme"/>
<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>
<div class="w3-panel w3-theme-l4">
<h3>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">
<xf:resource value="@xlink:href"/>
</xf:load>
</xf:trigger>
</xf:repeat>
</div>
</div>
<main id="main" style="{sidebar/@maindisplay}">
<div class="w3-theme">
<xf:trigger appearance="minimal" class="w3-button w3-xlarge material-icons" style="{sidebar/@navdisplay}">
<xf:label class="w3-theme"><xf:output value="icon[@id='i_expand']"/></xf:label> <!-- For some reason, using the "xf:label ref=..." pattern resulted in icon itself being unclickable ?-->
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="sidebar/@state" value="true()"/>
</xf:action>
</xf:trigger>
<div class="w3-container">
<h1>My Page</h1>
</div>
</div>
<xf:group ref="images/link[@xlink:title='car']">
<img src="{concat(../@baseurl, @xlink:href)}" alt="{@title}" style="width:50%"/>
</xf:group>
<div class="w3-container w3-theme-d3">
<p>This is modified version of the
<xf:group ref="link[@xlink:title='Slide the Page Content to the Right']" style="display: inline-block">
<a href="{@xlink:href}">
<xf:output ref="@xlink:title" style="text-decoration: underline;"/>
</a>
</xf:group> example on the W3 CSS page.
</p>
<p> Instead of Javascript being used to control the styling directly - the CSS changes are mapped to an XForms model.</p>
<p> See: <code>instance('app')/sidebar.</code> </p>
<p> XForms binds are used to generate the appropriate styling - and AVTs based on these bound values are applied to the elements in question </p>
</div>
</main>
</xf:group>
</body>
</html>