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
<?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">
 
    <xsl:template name="checkRequiredChildrenClass">
        <xsl:for-each select="*[not(self::xf:extension)][not(self::xf:label)]">
            <xsl:variable name="id" select="@id"/>
                <xsl:if test="//form/xf:model/xf:bind[@id = $id]/@required = 'true()'">
                    <xsl:text> cfRequiredlabel</xsl:text>
                </xsl:if>
        </xsl:for-each>
    </xsl:template>
    <xsl:template name="checkRequiredChildren">
        <xsl:for-each select="*[not(self::xf:extension)][not(self::xf:label)]">
            <xsl:variable name="id" select="@id"/>
                <xsl:if test="//form/xf:model/xf:bind[@id = $id]/@required = 'true()'">
                    <span class="cfRequiredLabelIndicator">&#160;* </span>
                </xsl:if>
        </xsl:for-each>
    </xsl:template>
    
    
    
    <!-- <cfformgroup type="horizontal"> -->
    <xsl:template match="xf:group[@appearance='horizontal']">
        <xsl:element name="table">
            <xsl:attribute name="border">0</xsl:attribute>
            <xsl:attribute name="cellspacing">0</xsl:attribute>
            <xsl:attribute name="cellpadding">0</xsl:attribute>
            <xsl:attribute name="class">horizontal</xsl:attribute>
 
 
            <xsl:element name="tr">
                <xsl:attribute name="class">cfElementRow</xsl:attribute>
                <!-- place group label in left column if one is defined -->
                <xsl:if test="position() = 1 and xf:label/text()">
                    <xsl:element name="td">
                        <xsl:attribute name="valign">top</xsl:attribute>
                        <xsl:attribute name="rowspan">99</xsl:attribute>
                        <xsl:attribute name="nowrap">nowrap</xsl:attribute>
                        <xsl:attribute name="class">cfLabelTitle cfLabelPosRight cfFirstChild <xsl:call-template name="checkRequiredChildrenClass"/></xsl:attribute>    
 
                        <xsl:call-template name="checkRequiredChildren"/>
                        <xsl:value-of select="xf:label/text()"/>
                    </xsl:element>
                </xsl:if>
                
                <xsl:for-each select="*[not(self::xf:extension)][not(self::xf:label)]">
                    <xsl:choose>
                        <!-- radio buttons -->
                        <xsl:when test="xf:select1[@appearance='full']">
                            <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="nowrap">nowrap</xsl:attribute>
 
                                    <xsl:element name="span">
                                    <xsl:choose>
                                        <xsl:when test="not( parent::*/xf:label/text() ) and position() = 1">        
                                            <xsl:attribute name="class">cfLabelTitle cfLabelPosRight cfFirstChild</xsl:attribute>        
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:attribute name="class">cfLabelTitle cfLabelPosRight</xsl:attribute>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                    <xsl:call-template name="label"/>
                                    </xsl:element>
                                    
                                    <xsl:for-each select="xf:select1[@appearance='full']/xf:choices/xf:item">
                                    <xsl:element name="p">
                                        <xsl:call-template name="radio"/>
                                    </xsl:element>
                                    </xsl:for-each>
 
                                </xsl:element>
                            </xsl:element>
                        </xsl:when>        
                        
                        
                        <!-- checkbox -->
                        <xsl:when test="xf:select1[@appearance='full']">
                            <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="nowrap">nowrap</xsl:attribute>
 
                                    <xsl:element name="span">
                                    <xsl:choose>
                                        <xsl:when test="not( parent::*/xf:label/text() ) and position() = 1">        
                                            <xsl:attribute name="class">cfLabelTitle cfLabelPosRight cfFirstChild</xsl:attribute>        
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:attribute name="class">cfLabelTitle cfLabelPosRight</xsl:attribute>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                    <xsl:call-template name="label"/>
                                    </xsl:element>
                                    
                                    <xsl:element name="p">
                                    <xsl:for-each select="xf:select1[@appearance='full']/xf:choices/xf:item">
                                        <xsl:call-template name="checkbox"/>
                                    </xsl:for-each>
                                    </xsl:element>
                                </xsl:element>
                            </xsl:element>
                        </xsl:when>    
                        
            
                        <xsl:otherwise>
                            <xsl:if test="xf:label/text() and not(self::xf:group) and not(self::xf:submit) and not(self::xf:trigger)">
                                <xsl:element name="td">
                                    <xsl:attribute name="valign">top</xsl:attribute>
                                    <xsl:attribute name="nowrap">nowrap</xsl:attribute>
                                    <xsl:choose>
                                        <xsl:when test="not( parent::*/xf:label/text() ) and position() = 1">        
                                            <xsl:attribute name="class">cfLabelTitle cfLabelPosRight cfFirstChild</xsl:attribute>        
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:attribute name="class">cfLabelTitle cfLabelPosRight</xsl:attribute>
                                        </xsl:otherwise>
                                    </xsl:choose>
        
                                    <xsl:call-template name="label"/>
                                </xsl:element>
                            </xsl:if>
                            <xsl:element name="td">
                                <xsl:apply-templates select="."/>
                            </xsl:element>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:for-each>
            </xsl:element>
        </xsl:element>
    </xsl:template>
    
</xsl:stylesheet>