[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 | module : |
---|
| 9 | transformation des elements de formulaires docbook en html |
---|
| 10 | |
---|
[48] | 11 | update : |
---|
[33] | 12 | $Id$ |
---|
[55] | 13 | fplod 2008-04-28T15:29:15Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
[56] | 14 | dbk5 in |
---|
[2] | 15 | fplod 2007-04-27T15:08:17Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 16 | ++ inclusion php d'après http://www.cygwin.com/ml/docbook-apps/2005-q1/msg00484.html |
---|
| 17 | je laisse les xsl:processing-instruction qui devraient pouvoir marcher mais je ne sais pas pourquoi xsltproc |
---|
[56] | 18 | ne veut rien mettre dans le contenu de l'attribut value d'un input ... cf méchant sed dans makefile |
---|
[2] | 19 | fplod 2007-04-20T13:39:00Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 20 | création |
---|
| 21 | --> |
---|
| 22 | |
---|
[55] | 23 | <xsl:template match="html:form"> |
---|
[2] | 24 | <xsl:text>
</xsl:text> |
---|
| 25 | <xsl:element name="form"> |
---|
| 26 | <xsl:if test="@action"> |
---|
| 27 | <xsl:attribute name="action"><xsl:value-of select="@action"/> |
---|
| 28 | <!--?subject=[nemo survey 2007 cf form_db.xsl --> |
---|
| 29 | <xsl:processing-instruction name="php"> |
---|
| 30 | <xsl:text> |
---|
| 31 | /* |
---|
| 32 | Définit le fuseau horaire par défaut à utiliser. Disponible depuis PHP |
---|
| 33 | 5.1 |
---|
| 34 | date_default_timezone_set('UTC'); ++ |
---|
| 35 | */ |
---|
| 36 | error_reporting(E_ALL); |
---|
| 37 | |
---|
| 38 | DATE_ISO8601_mod = 'Y-m-d\TH:i:s\Z'; /* +Z - fraction seconde */ |
---|
| 39 | |
---|
| 40 | echo gmdate($DATE_ISO8601_mod); |
---|
| 41 | </xsl:text> |
---|
| 42 | </xsl:processing-instruction> |
---|
| 43 | </xsl:attribute> |
---|
| 44 | </xsl:if> |
---|
| 45 | <xsl:if test="@method"> |
---|
| 46 | <xsl:attribute name="method"><xsl:value-of select="@method"/></xsl:attribute> |
---|
| 47 | </xsl:if> |
---|
| 48 | <xsl:if test="@enctype"> |
---|
| 49 | <xsl:attribute name="enctype"><xsl:value-of select="@enctype"/></xsl:attribute> |
---|
| 50 | </xsl:if> |
---|
| 51 | <xsl:apply-templates/> |
---|
| 52 | </xsl:element> |
---|
| 53 | </xsl:template> |
---|
| 54 | |
---|
[55] | 55 | <xsl:template match="html:fieldset"> |
---|
[2] | 56 | <xsl:text>
</xsl:text> |
---|
| 57 | <xsl:element name="fieldset"> |
---|
[56] | 58 | <xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute> |
---|
[2] | 59 | <xsl:apply-templates/> |
---|
| 60 | </xsl:element> |
---|
| 61 | </xsl:template> |
---|
| 62 | |
---|
[56] | 63 | <xsl:template match="html:label"> |
---|
[2] | 64 | <xsl:text>
</xsl:text> |
---|
| 65 | <xsl:element name="label"> |
---|
| 66 | <xsl:apply-templates/> |
---|
| 67 | </xsl:element> |
---|
| 68 | </xsl:template> |
---|
| 69 | |
---|
[55] | 70 | <xsl:template match="html:legend"> |
---|
[2] | 71 | <legend><xsl:apply-templates/></legend> |
---|
| 72 | </xsl:template> |
---|
| 73 | |
---|
[56] | 74 | <xsl:template match="html:input"> |
---|
[2] | 75 | <xsl:text>
</xsl:text> |
---|
| 76 | <xsl:element name="input"> |
---|
| 77 | <xsl:if test="@name"> |
---|
| 78 | <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> |
---|
| 79 | </xsl:if> |
---|
| 80 | <xsl:if test="@type"> |
---|
| 81 | <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute> |
---|
| 82 | </xsl:if> |
---|
| 83 | <xsl:if test="@tabindex"> |
---|
| 84 | <xsl:attribute name="tabindex"><xsl:value-of select="@tabindex"/></xsl:attribute> |
---|
| 85 | </xsl:if> |
---|
| 86 | <xsl:if test="@value"> |
---|
| 87 | <xsl:attribute name="value"> |
---|
| 88 | <xsl:value-of select="@value"/> |
---|
| 89 | </xsl:attribute> |
---|
| 90 | </xsl:if> |
---|
| 91 | <xsl:if test="not(@value)"> |
---|
| 92 | <xsl:choose> |
---|
| 93 | <xsl:when test="@name='timestamp'"> |
---|
| 94 | <xsl:attribute name="value"> |
---|
| 95 | <xsl:processing-instruction name="php"> |
---|
| 96 | <xsl:text> |
---|
| 97 | /* |
---|
| 98 | Définit le fuseau horaire par défaut à utiliser. Disponible depuis PHP |
---|
| 99 | 5.1 |
---|
| 100 | date_default_timezone_set('UTC'); ++ |
---|
| 101 | */ |
---|
| 102 | error_reporting(E_ALL); |
---|
| 103 | |
---|
| 104 | DATE_ISO8601_mod = 'Y-m-d\TH:i:s\Z'; /* +Z - fraction seconde */ |
---|
| 105 | |
---|
| 106 | echo date($DATE_ISO8601_mod); |
---|
| 107 | </xsl:text> |
---|
| 108 | </xsl:processing-instruction> |
---|
| 109 | </xsl:attribute> |
---|
| 110 | </xsl:when> |
---|
| 111 | <xsl:when test="@name='server'"> |
---|
| 112 | <xsl:attribute name="value"> |
---|
| 113 | <xsl:processing-instruction name="php"> |
---|
| 114 | <xsl:text> |
---|
| 115 | echo $_SERVER['HTTP_USER_AGENT']; |
---|
| 116 | </xsl:text> |
---|
| 117 | </xsl:processing-instruction> |
---|
| 118 | </xsl:attribute> |
---|
| 119 | </xsl:when> |
---|
| 120 | <xsl:when test="@name='phpversion'"> |
---|
| 121 | <xsl:attribute name="value"> |
---|
| 122 | <xsl:processing-instruction name="php"> |
---|
| 123 | <xsl:text> |
---|
| 124 | echo phpversion(); |
---|
| 125 | </xsl:text> |
---|
| 126 | </xsl:processing-instruction> |
---|
| 127 | </xsl:attribute> |
---|
| 128 | </xsl:when> |
---|
| 129 | <xsl:otherwise> |
---|
| 130 | <xsl:message terminate="yes"> |
---|
| 131 | eee : input <xsl:value-of select="@name"/> without @value |
---|
| 132 | </xsl:message> |
---|
| 133 | </xsl:otherwise> |
---|
| 134 | </xsl:choose> |
---|
| 135 | </xsl:if> |
---|
| 136 | <xsl:if test="@checked"> |
---|
| 137 | <xsl:attribute name="checked"><xsl:value-of select="@checked"/></xsl:attribute> |
---|
| 138 | </xsl:if> |
---|
| 139 | <xsl:if test="@readonly"> |
---|
| 140 | <xsl:attribute name="readonly"><xsl:value-of select="@readonly"/></xsl:attribute> |
---|
| 141 | </xsl:if> |
---|
| 142 | <xsl:apply-templates/> |
---|
| 143 | </xsl:element> |
---|
| 144 | </xsl:template> |
---|
| 145 | |
---|
[56] | 146 | <xsl:template match="html:textarea"> |
---|
[2] | 147 | <xsl:text>
</xsl:text> |
---|
| 148 | <xsl:element name="textarea"> |
---|
| 149 | <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> |
---|
| 150 | <xsl:attribute name="cols"><xsl:value-of select="@cols"/></xsl:attribute> |
---|
| 151 | <xsl:attribute name="rows"><xsl:value-of select="@rows"/></xsl:attribute> |
---|
| 152 | <xsl:apply-templates/> |
---|
| 153 | </xsl:element> |
---|
| 154 | </xsl:template> |
---|
[56] | 155 | <xsl:template match="html:form/html:select"> |
---|
[2] | 156 | <xsl:text>
</xsl:text> |
---|
| 157 | <xsl:element name="select"> |
---|
| 158 | <xsl:if test="@name"> |
---|
| 159 | <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> |
---|
| 160 | </xsl:if> |
---|
[56] | 161 | <xsl:if test="@xml:id"> |
---|
| 162 | <xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute> |
---|
[2] | 163 | </xsl:if> |
---|
| 164 | <xsl:if test="@multiple"> |
---|
| 165 | <xsl:attribute name="multiple"><xsl:value-of select="@multiple"/></xsl:attribute> |
---|
| 166 | </xsl:if> |
---|
| 167 | <xsl:if test="@onChange"> |
---|
| 168 | <xsl:attribute name="onChange"><xsl:value-of select="@onChange"/></xsl:attribute> |
---|
| 169 | </xsl:if> |
---|
| 170 | <xsl:apply-templates/> |
---|
| 171 | </xsl:element> |
---|
| 172 | </xsl:template> |
---|
| 173 | |
---|
[56] | 174 | <xsl:template match="html:option"> |
---|
[2] | 175 | <xsl:text>
</xsl:text> |
---|
| 176 | <xsl:element name="option"> |
---|
| 177 | <xsl:if test="@value"> |
---|
| 178 | <xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute> |
---|
| 179 | </xsl:if> |
---|
| 180 | <xsl:if test="@SELECTED"> |
---|
| 181 | <xsl:attribute name="SELECTED"><xsl:value-of select="@SELECTED"/></xsl:attribute> |
---|
| 182 | </xsl:if> |
---|
| 183 | <xsl:apply-templates/> |
---|
| 184 | </xsl:element> |
---|
| 185 | </xsl:template> |
---|
| 186 | |
---|
[56] | 187 | </xsl:stylesheet> |
---|