
ejercicio
Publicado por Joe (1 intervención) el 26/05/2022 23:45:22
Hola tengo este xml y xsd pero no se como modificarlo para que quede como se ve en la imagen

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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match='/'>
<html>
<head>
</head>
<body>
<h2><center>EXAMEN</center></h2>
<table border="1" width="500" align="center">
<form action="" method="get">
<xsl:for-each select="examen/cuestion">
<xsl:choose>
<xsl:when test="(@tipo = 'multiple')">
<tr>
<td colspan="2">
<font size="+1">
<xsl:value-of select="pregunta" />
</font>
</td>
</tr>
<xsl:for-each select="opciones/opcion">
<tr>
<td width="1">
<input type="checkbox">
<xsl:attribute name="id"><xsl:value-of select="namechk" /></xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="namechk" /></xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="texto" /></xsl:attribute>
</input>
</td>
<td>
<xsl:value-of select="texto" />
</td>
</tr>
</xsl:for-each>
</xsl:when>
<xsl:when test="(@tipo = 'numero')">
<tr><td colspan="2"> </td></tr>
<tr><td colspan="2"> </td></tr>
</xsl:when>
<xsl:when test="(@tipo = 'bool')">
<tr><td colspan="2"></td></tr>
<tr><td width="50"> </td><td> </td></tr>
<tr><td width="50"> </td><td> </td></tr>
</xsl:when>
<xsl:when test="(@tipo = 'rollo')">
<tr><td colspan="2"> </td></tr>
<tr><td colspan="2"> </td></tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</form>
</table>
<input type="submit" value="Enviar respuesta" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
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
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="examen.xsl"?>
<examen>
<cuestion tipo="multiple">
<pregunta>1) Harías puenting alguna vez en tu vida?</pregunta>
<opciones>
<opcion>
<texto>Si</texto>
<namechk>chk11</namechk>
</opcion>
<opcion>
<texto>No</texto>
<namechk>chk12</namechk>
</opcion>
<opcion>
<texto>Depende</texto>
<namechk>chk13</namechk>
</opcion>
<opcion>
<texto>Quizás</texto>
<namechk>chk14</namechk>
</opcion>
</opciones>
</cuestion>
<cuestion tipo="numero">
<pregunta>2) Introduce el nombre de tu deportista favorito:</pregunta>
</cuestion>
<cuestion tipo="bool">
<pregunta>3) Te gusta el fútbol?</pregunta>
</cuestion>
<cuestion tipo="rollo">
<pregunta>4) Explica en qué consiste el curling?</pregunta>
</cuestion>
</examen>

Valora esta pregunta


0