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
| <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:edXml="http://127.0.0.1/test/">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="edXml:Object">
<center>
<h2>.: <xsl:value-of select="@name"/> :.</h2>
</center>
<br />
<br />
<table border='0' align='center'>
<xsl:apply-templates select="edXml:ChampTexte | edXml:ChampBoolean | edXml:ChampListe | edXml:ChampTexteLong"/>
<tr>
<td></td>
<td>
<input type="submit" value="valider"/>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="edXml:ChampTexte">
<tr>
<td>
<xsl:value-of select="@key"/>
</td>
<td>
<input type="text" value="{.}" name="{@key}" size="{string-length(.)}"/>
</td>
</tr>
</xsl:template>
<xsl:template match="edXml:ChampTexteLong">
<tr>
<td>
<xsl:value-of select="@name"/>
</td>
<td>
<xsl:element name="textarea">
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:if test="@width">
<xsl:attribute name="cols"><xsl:value-of select="@width"/></xsl:attribute>
</xsl:if>
<xsl:if test="@height">
<xsl:attribute name="rows"><xsl:value-of select="@height"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:element>
</td>
</tr>
</xsl:template>
<xsl:template match="edXml:ChampBoolean">
<tr>
<td>
<xsl:value-of select="@key"/>
</td>
<td>true<xsl:element name="input">
<xsl:attribute name="type">radio</xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="@key"/></xsl:attribute>
<xsl:attribute name="value">true</xsl:attribute>
<xsl:if test="boolean(number(@value))">
<xsl:attribute name="checked">on</xsl:attribute>
</xsl:if>
</xsl:element>false<xsl:element name="input">
<xsl:attribute name="type">radio</xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="@key"/></xsl:attribute>
<xsl:attribute name="value">false</xsl:attribute>
<xsl:if test="boolean(number(@value))">
<xsl:attribute name="checked">on</xsl:attribute>
</xsl:if>
</xsl:element>
</td>
</tr>
</xsl:template>
<xsl:template match="edXml:ChampListe">
<tr>
<th align="right">
<xsl:value-of select="@name"/>
</th>
<td>
<select name="{@name}">
<xsl:for-each select="edXml:Option">
<xsl:element name="option">
<xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:if test="boolean(number(@selected))">
<xsl:attribute name="selected">on</xsl:attribute>
</xsl:if>
<xsl:value-of select="@label"/>
</xsl:element>
</xsl:for-each>
</select>
</td>
</tr>
</xsl:template>
</xsl:stylesheet> |
Partager