1 | <?xml version='1.0' encoding='ISO-8859-1'?> |
---|
2 | <xsl:stylesheet |
---|
3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
4 | xmlns:html="http://www.w3.org/1999/xhtml" |
---|
5 | version="1.0"> |
---|
6 | |
---|
7 | <!--rst |
---|
8 | |
---|
9 | .. _form_rest.xsl: |
---|
10 | |
---|
11 | ============= |
---|
12 | form_rest.xsl |
---|
13 | ============= |
---|
14 | |
---|
15 | DESCRIPTION |
---|
16 | =========== |
---|
17 | |
---|
18 | transformation des elements de formulaires docbook en rest |
---|
19 | |
---|
20 | TODO |
---|
21 | ==== |
---|
22 | |
---|
23 | make it work |
---|
24 | |
---|
25 | EVOLUTIONS |
---|
26 | ========== |
---|
27 | |
---|
28 | $Id$ |
---|
29 | $URL$ |
---|
30 | |
---|
31 | - fplod 20110629T125748Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
32 | |
---|
33 | * création |
---|
34 | |
---|
35 | --> |
---|
36 | |
---|
37 | <xsl:template match="html:form"> |
---|
38 | <xsl:text>
</xsl:text> |
---|
39 | <xsl:element name="form"> |
---|
40 | <xsl:if test="@action"> |
---|
41 | <xsl:attribute name="action"><xsl:value-of select="@action"/> |
---|
42 | <!--?subject=[nemo survey 2007 cf form_db.xsl --> |
---|
43 | <xsl:processing-instruction name="php"> |
---|
44 | <xsl:text> |
---|
45 | /* |
---|
46 | Définit le fuseau horaire par défaut à utiliser. Disponible depuis PHP |
---|
47 | 5.1 |
---|
48 | date_default_timezone_set('UTC'); ++ |
---|
49 | */ |
---|
50 | error_reporting(E_ALL); |
---|
51 | |
---|
52 | DATE_ISO8601_mod = 'Y-m-d\TH:i:s\Z'; /* +Z - fraction seconde */ |
---|
53 | |
---|
54 | echo gmdate($DATE_ISO8601_mod); |
---|
55 | </xsl:text> |
---|
56 | </xsl:processing-instruction> |
---|
57 | </xsl:attribute> |
---|
58 | </xsl:if> |
---|
59 | <xsl:if test="@method"> |
---|
60 | <xsl:attribute name="method"><xsl:value-of select="@method"/></xsl:attribute> |
---|
61 | </xsl:if> |
---|
62 | <xsl:if test="@enctype"> |
---|
63 | <xsl:attribute name="enctype"><xsl:value-of select="@enctype"/></xsl:attribute> |
---|
64 | </xsl:if> |
---|
65 | <xsl:apply-templates/> |
---|
66 | </xsl:element> |
---|
67 | </xsl:template> |
---|
68 | |
---|
69 | <xsl:template match="html:fieldset"> |
---|
70 | <xsl:text>
</xsl:text> |
---|
71 | <xsl:element name="fieldset"> |
---|
72 | <xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute> |
---|
73 | <xsl:apply-templates/> |
---|
74 | </xsl:element> |
---|
75 | </xsl:template> |
---|
76 | |
---|
77 | <xsl:template match="html:label"> |
---|
78 | <xsl:text>
</xsl:text> |
---|
79 | <xsl:element name="label"> |
---|
80 | <xsl:apply-templates/> |
---|
81 | </xsl:element> |
---|
82 | </xsl:template> |
---|
83 | |
---|
84 | <xsl:template match="html:legend"> |
---|
85 | <legend><xsl:apply-templates/></legend> |
---|
86 | </xsl:template> |
---|
87 | |
---|
88 | <xsl:template match="html:input"> |
---|
89 | <xsl:text>
</xsl:text> |
---|
90 | <xsl:element name="input"> |
---|
91 | <xsl:if test="@name"> |
---|
92 | <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> |
---|
93 | </xsl:if> |
---|
94 | <xsl:if test="@type"> |
---|
95 | <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute> |
---|
96 | </xsl:if> |
---|
97 | <xsl:if test="@tabindex"> |
---|
98 | <xsl:attribute name="tabindex"><xsl:value-of select="@tabindex"/></xsl:attribute> |
---|
99 | </xsl:if> |
---|
100 | <xsl:if test="@value"> |
---|
101 | <xsl:attribute name="value"> |
---|
102 | <xsl:value-of select="@value"/> |
---|
103 | </xsl:attribute> |
---|
104 | </xsl:if> |
---|
105 | <xsl:if test="not(@value)"> |
---|
106 | <xsl:choose> |
---|
107 | <xsl:when test="@name='timestamp'"> |
---|
108 | <xsl:attribute name="value"> |
---|
109 | <xsl:processing-instruction name="php"> |
---|
110 | <xsl:text> |
---|
111 | /* |
---|
112 | Définit le fuseau horaire par défaut à utiliser. Disponible depuis PHP |
---|
113 | 5.1 |
---|
114 | date_default_timezone_set('UTC'); ++ |
---|
115 | */ |
---|
116 | error_reporting(E_ALL); |
---|
117 | |
---|
118 | DATE_ISO8601_mod = 'Y-m-d\TH:i:s\Z'; /* +Z - fraction seconde */ |
---|
119 | |
---|
120 | echo date($DATE_ISO8601_mod); |
---|
121 | </xsl:text> |
---|
122 | </xsl:processing-instruction> |
---|
123 | </xsl:attribute> |
---|
124 | </xsl:when> |
---|
125 | <xsl:when test="@name='server'"> |
---|
126 | <xsl:attribute name="value"> |
---|
127 | <xsl:processing-instruction name="php"> |
---|
128 | <xsl:text> |
---|
129 | echo $_SERVER['HTTP_USER_AGENT']; |
---|
130 | </xsl:text> |
---|
131 | </xsl:processing-instruction> |
---|
132 | </xsl:attribute> |
---|
133 | </xsl:when> |
---|
134 | <xsl:when test="@name='phpversion'"> |
---|
135 | <xsl:attribute name="value"> |
---|
136 | <xsl:processing-instruction name="php"> |
---|
137 | <xsl:text> |
---|
138 | echo phpversion(); |
---|
139 | </xsl:text> |
---|
140 | </xsl:processing-instruction> |
---|
141 | </xsl:attribute> |
---|
142 | </xsl:when> |
---|
143 | <xsl:otherwise> |
---|
144 | <xsl:message terminate="yes"> |
---|
145 | eee : input <xsl:value-of select="@name"/> without @value |
---|
146 | </xsl:message> |
---|
147 | </xsl:otherwise> |
---|
148 | </xsl:choose> |
---|
149 | </xsl:if> |
---|
150 | <xsl:if test="@checked"> |
---|
151 | <xsl:attribute name="checked"><xsl:value-of select="@checked"/></xsl:attribute> |
---|
152 | </xsl:if> |
---|
153 | <xsl:if test="@readonly"> |
---|
154 | <xsl:attribute name="readonly"><xsl:value-of select="@readonly"/></xsl:attribute> |
---|
155 | </xsl:if> |
---|
156 | <xsl:apply-templates/> |
---|
157 | </xsl:element> |
---|
158 | </xsl:template> |
---|
159 | |
---|
160 | <xsl:template match="html:textarea"> |
---|
161 | <xsl:text>
</xsl:text> |
---|
162 | <xsl:element name="textarea"> |
---|
163 | <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> |
---|
164 | <xsl:attribute name="cols"><xsl:value-of select="@cols"/></xsl:attribute> |
---|
165 | <xsl:attribute name="rows"><xsl:value-of select="@rows"/></xsl:attribute> |
---|
166 | <xsl:apply-templates/> |
---|
167 | </xsl:element> |
---|
168 | </xsl:template> |
---|
169 | <xsl:template match="html:form/html:select"> |
---|
170 | <xsl:text>
</xsl:text> |
---|
171 | <xsl:element name="select"> |
---|
172 | <xsl:if test="@name"> |
---|
173 | <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> |
---|
174 | </xsl:if> |
---|
175 | <xsl:if test="@xml:id"> |
---|
176 | <xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute> |
---|
177 | </xsl:if> |
---|
178 | <xsl:if test="@multiple"> |
---|
179 | <xsl:attribute name="multiple"><xsl:value-of select="@multiple"/></xsl:attribute> |
---|
180 | </xsl:if> |
---|
181 | <xsl:if test="@onChange"> |
---|
182 | <xsl:attribute name="onChange"><xsl:value-of select="@onChange"/></xsl:attribute> |
---|
183 | </xsl:if> |
---|
184 | <xsl:apply-templates/> |
---|
185 | </xsl:element> |
---|
186 | </xsl:template> |
---|
187 | |
---|
188 | <xsl:template match="html:option"> |
---|
189 | <xsl:text>
</xsl:text> |
---|
190 | <xsl:element name="option"> |
---|
191 | <xsl:if test="@value"> |
---|
192 | <xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute> |
---|
193 | </xsl:if> |
---|
194 | <xsl:if test="@SELECTED"> |
---|
195 | <xsl:attribute name="SELECTED"><xsl:value-of select="@SELECTED"/></xsl:attribute> |
---|
196 | </xsl:if> |
---|
197 | <xsl:apply-templates/> |
---|
198 | </xsl:element> |
---|
199 | </xsl:template> |
---|
200 | |
---|
201 | </xsl:stylesheet> |
---|