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