Home directory for Malawi's wwwroot
Duncan Ewan
2021-02-19 3e758c29e0fde36fc088efcfc88f9a3014432b64
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
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 1995-2005 Macromedia, Inc. All rights reserved. -->
 
<xsl:stylesheet version="1.0"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:cf="http://www.macromedia.com/2004/cfform" 
xmlns:xf="http://www.w3.org/2002/xforms" 
xmlns:html="http://www.w3.org/1999/xhtml" 
exclude-result-prefixes="xsi cf xsl xf html">
 
    <!-- <cfformgroup type="vertical">-->
    <xsl:template match="xf:group[@appearance='vertical']">
        <xsl:param name="attribs"/> <!-- string of attribute to be added to all children elements -->
        <xsl:call-template name="vertical">
            <xsl:with-param name="attribs" select="$attribs"/>
        </xsl:call-template> 
    </xsl:template>
    
    
    
    <!-- default vertical align group -->
    <xsl:template name="vertical">
        <xsl:param name="attribs"/> <!-- string of attribute to be added to all children elements -->
                
        <xsl:element name="table">
        <xsl:attribute name="border">0</xsl:attribute>
        <xsl:attribute name="cellpadding">2</xsl:attribute>
        <xsl:attribute name="cellspacing">0</xsl:attribute>
        <xsl:attribute name="width">100%</xsl:attribute>
        <xsl:attribute name="class">vertical</xsl:attribute>
        
        <xsl:if test="xf:label/text()">
            <xsl:element name="tr">
                <xsl:element name="td">
                    <!-- align nested groups -->
                    <xsl:if test="xf:extension/cf:attribute[@name='align']">
                        <xsl:attribute name="align"><xsl:value-of select="xf:extension/cf:attribute[@name='align']"/>                            </xsl:attribute>
                    </xsl:if>                                            
                    <xsl:attribute name="colspan">2</xsl:attribute>
                    <xsl:attribute name="class">cfHeaderTitle</xsl:attribute>
                    <xsl:value-of select="xf:label/text()"/>
                </xsl:element>
            </xsl:element>                            
        </xsl:if>
 
                <xsl:for-each select="*[not(self::xf:label)][not(self::xf:extension)][not(self::xf:model)]">
                    <xsl:choose>
                        <!-- textarea controls -->
                        <xsl:when test="self::xf:textarea and xf:label/text()">
                            <xsl:element name="tr">
                                <xsl:attribute name="class">cfElementRow</xsl:attribute>
                                <xsl:element name="td">
                                    <xsl:attribute name="colspan">2</xsl:attribute>
                                    <xsl:attribute name="valign">top</xsl:attribute>
                                    <xsl:attribute name="align">left</xsl:attribute>                                    
                                    <xsl:attribute name="class">cfLabelTitle cfLabelPosTop</xsl:attribute>
                                    <xsl:attribute name="nowrap">nowrap</xsl:attribute>
                                    <xsl:call-template name="label"/>
                                </xsl:element>
                            </xsl:element>
                            <xsl:element name="tr">
                                <xsl:element name="td">
                                    <xsl:attribute name="colspan">2</xsl:attribute>
                                    <xsl:attribute name="width">100%</xsl:attribute>
                                    <xsl:attribute name="align">left</xsl:attribute>
                                    <xsl:apply-templates select=".">
                                        <xsl:with-param name="attribs" select="$attribs"/>
                                    </xsl:apply-templates>
                                </xsl:element>
                            </xsl:element>
                        </xsl:when>
                        
                        <!-- radio buttons -->
                        <xsl:when test="self::xf:select1[@appearance='full']">
                            <xsl:for-each select="xf:choices/xf:item">
                                <xsl:element name="tr">
                                    <xsl:attribute name="class">cfElementRow</xsl:attribute>
                                    <xsl:element name="td">
                                        <xsl:attribute name="valign">top</xsl:attribute>
                                        <xsl:attribute name="align">right</xsl:attribute>
                                        <xsl:attribute name="width">100</xsl:attribute>
                                        <xsl:attribute name="class">cfLabelTitle cfLabelPosRight cfFirstChild</xsl:attribute>
                                        <xsl:attribute name="nowrap">nowrap</xsl:attribute>
                                    </xsl:element>
                                    <xsl:element name="td">
                                        <xsl:attribute name="width">1000</xsl:attribute>
                                        <xsl:element name="p">
                                        
                                            <xsl:call-template name="radio">
                                                <xsl:with-param name="attribs" select="$attribs"/>
                                            </xsl:call-template>
    
                                        </xsl:element>
                                    </xsl:element>
                                </xsl:element>
                            </xsl:for-each>
                        </xsl:when>        
                        
                        <xsl:when test="self::cf:grid">
                            <xsl:element name="tr">
                                <xsl:attribute name="class">cfElementRow</xsl:attribute>
                                <xsl:element name="td">
                                    <xsl:attribute name="colspan">2</xsl:attribute>
                                    <xsl:attribute name="valign">top</xsl:attribute>
                                    <xsl:attribute name="align">center</xsl:attribute>    
    
                                    <xsl:apply-templates select="."/>
                                </xsl:element>
                            </xsl:element>
                        </xsl:when>
                        
                        <!-- checkbox buttons -->
                        <xsl:when test="self::xf:select[@appearance='full']">
                            <!-- group label, if it exists -->
                            <xsl:if test="xf:label/text()  and count(xf:select[@appearance='full']/xf:choices/xf:item) > 1">
                                <xsl:element name="tr">
                                    <xsl:element name="td">
                                        <xsl:attribute name="colspan">2</xsl:attribute>
                                        <xsl:attribute name="width">100%</xsl:attribute>
                                        <xsl:attribute name="class">cfHeaderTitle</xsl:attribute>
                                        <xsl:value-of select="xf:label/text()"/>
                                    </xsl:element>                                    
                                </xsl:element>
                            </xsl:if>
                        
                        
                            <xsl:for-each select="xf:choices/xf:item">
                            <xsl:element name="tr">
                                <xsl:attribute name="class">cfElementRow</xsl:attribute>
                                <xsl:element name="td">
                                    <xsl:attribute name="valign">top</xsl:attribute>
                                    <xsl:attribute name="align">right</xsl:attribute>
                                    <xsl:attribute name="width">100</xsl:attribute>
                                    <xsl:attribute name="class">cfLabelTitle cfLabelPosRight cfFirstChild</xsl:attribute>
                                    <xsl:attribute name="nowrap">nowrap</xsl:attribute>
                                    <xsl:if test="count(parent::*/parent::*/parent::*/xf:select[@appearance='full']) = 1">
                                        <!--<xsl:value-of select="xf:label/text()"/>-->
                                    </xsl:if>
                                </xsl:element>                                
                                <xsl:element name="td">
                                    <xsl:attribute name="width">1000</xsl:attribute>
                                    <xsl:element name="p">
                                        <xsl:call-template name="checkbox">
                                            <xsl:with-param name="attribs" select="$attribs"/>                                        
                                        </xsl:call-template>
                                    </xsl:element>
                                </xsl:element>
                            </xsl:element>
                            </xsl:for-each>
                        </xsl:when>                                        
                                            
 
                        <!-- other form controls -->
                        <xsl:when test="not(self::xf:group) and not(self::xf:output) and not(self::xf:submit) and not(self::xf:trigger)">
                            <xsl:element name="tr">
                                <xsl:attribute name="class">cfElementRow</xsl:attribute>
                            <!-- replace with cfHeaderTitle in separate row 
                                <xsl:if test="position() = 1 and parent::*/xf:label/text()">
                                    <xsl:element name="td">
                                        <xsl:attribute name="valign">top</xsl:attribute>
                                        <xsl:attribute name="rowspan">99</xsl:attribute>
                                        <xsl:attribute name="width">100</xsl:attribute>
                                        <xsl:attribute name="class">cfLabelTitle cfLabelPosRight cfFirstChild</xsl:attribute>
                                        <xsl:attribute name="nowrap">nowrap</xsl:attribute>
                                        <xsl:value-of select="parent::*/xf:label/text()"/>
                                    </xsl:element>
                                </xsl:if>
                            -->
                                <xsl:element name="td">
                                    <xsl:attribute name="valign">top</xsl:attribute>
                                    <xsl:attribute name="align">right</xsl:attribute>
                                    <xsl:attribute name="width">100</xsl:attribute>
                                    <xsl:attribute name="class">cfLabelTitle cfLabelPosRight cfFirstChild</xsl:attribute>
                                    <xsl:attribute name="nowrap">nowrap</xsl:attribute>
                                    <xsl:call-template name="label"/>
                                </xsl:element>
                                <xsl:element name="td">
                                    <xsl:attribute name="width">1000</xsl:attribute>
                                    <xsl:attribute name="align">left</xsl:attribute>
                                    <!-- <xsl:element name="p"> -->
                                    <xsl:apply-templates select=".">
                                        <xsl:with-param name="attribs" select="$attribs"/>
                                    </xsl:apply-templates>
                                    <!-- </xsl:element> -->
                                </xsl:element>
                            </xsl:element>
                        </xsl:when>
            
                                                            
                        
                        <!-- follow nested groups -->
                        <xsl:otherwise>
                            <xsl:element name="tr">
                                <xsl:element name="td">
                                    <!-- align nested groups -->
                                    <xsl:if test="xf:extension/cf:attribute[@name='align']">
                                        <xsl:attribute name="align"><xsl:value-of select="xf:extension/cf:attribute[@name='align']"/></xsl:attribute>
                                    </xsl:if>        
                                    
                                    <xsl:attribute name="colspan">2</xsl:attribute>
                                    <xsl:apply-templates select=".">
                                        <xsl:with-param name="attribs" select="$attribs"/>
                                    </xsl:apply-templates>
                                </xsl:element>
                            </xsl:element>
                        </xsl:otherwise>
                    </xsl:choose>
                
            </xsl:for-each>
            <xsl:element name="tr">
                <xsl:element name="td">
                    <xsl:element name="br"/>
                </xsl:element>
            </xsl:element>
        </xsl:element>
    </xsl:template>
    
 
 
</xsl:stylesheet>