Foros del Web » Programación para mayores de 30 ;) » Programación General »

no visualizo correctamente

Estas en el tema de no visualizo correctamente en el foro de Programación General en Foros del Web. hola a to2, estoy intentando crear un cuestionario a partir de un xml y un xsl mi problema es que quiero dentro de una tabla ...
  #1 (permalink)  
Antiguo 23/09/2005, 02:58
 
Fecha de Ingreso: septiembre-2003
Mensajes: 341
Antigüedad: 20 años, 7 meses
Puntos: 0
no visualizo correctamente

hola a to2,
estoy intentando crear un cuestionario a partir de un xml y un xsl

mi problema es que quiero dentro de una tabla que me aparezcan las opciones "CUESTION3DECISION", para ello en "CABECERATABLA" llamo a "CUESTION3DECISION", pero solamente me escribe el texto y no las opciones....
alguien puede ayudarme?

aqui teneis el xml:
Código:
 
<?xml version='1.0' encoding="ISO-8859-1"?>
<CUESTIONARIO nombre="Cuestionario1" archivo="Cuestionario1.xml">
<SECCION>
<CABECERATABLA>
<TEXTO>TITULO PREGUNTA</TEXTO>
<CUESTION3DECISION NUMERO="1">
<PREGUNTA>1. Pregunta 1</PREGUNTA>
</CUESTION3DECISION>
</CABECERATABLA>
 
</SECCION>
</CUESTIONARIO>
y aquí está el xsl
Código:
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" > 
<xsl:template> 
	<xsl:copy>
	 <xsl:apply-templates select="@*"/>	 
	 <xsl:apply-templates/>
	</xsl:copy> 
</xsl:template>
 
<xsl:template match="CUESTIONARIO">
<html>
<head>
<title>Cuestionario</title> 
<link rel="stylesheet" type="text/css" href="../../css/estilos.css"/>
<script>
	var numP = <xsl:eval>numeroPreguntas(this)</xsl:eval>
	var nomFichero = '<xsl:value-of select="@archivo"/>'
</script> 
<script language="javascript" src="../../js/funciones.js"></script>
</head>
<body bgcolor="#FFFFFF" background="../../images/fondo.gif">
<xsl:attribute name="onload">iniciar();</xsl:attribute>
<FORM name="formulenvio" METHOD="POST"> 
<xsl:attribute name="ACTION"><xsl:value-of select="@nombre"/>corregir.asp</xsl:attribute>
<table width="610" border="1" cellspacing="0" cellpadding="0" vspace="30" hspace="20">
<tr>
	<td valign="left" colspan="2">
	<div class="lineaizq2">
<div class="titulo"><a name="ini"></a>Cuestionario <xsl:value-of select="@nombre"/></div>
<div class="subtitulo"></div>
</div>
</td>
</tr>
<tr> 
	<td height="1" width="15"> </td>
<td>
<div id="result">
	 <xsl:apply-templates/>
	 </div>
</td>
</tr>
<tr>	 
	<td width="*" align="left" colspan="2"> 
	<div class="lineasup">
	 <a class="norm" href="javascript:enviar_resultados();"><img src="../../images/botones/enviar.gif" width="31" height="36" border="0" alt="Enviar datos..."/></a> 
	 </div> 
	</td>
</tr> 
<tr>	 
	<td width="*" align="right" colspan="2"> 
	 <div class="lineasup"><a class="norm" href="javascript:window.history.back()" target="ut_centro"><img src="../../images/botones/atras.gif" width="31" height="36" border="0" alt="volver atras"/></a></div>
	</td>
</tr>
</table>
<INPUT TYPE='HIDDEN' NAME='datos' VALUE=""/>
<INPUT TYPE='HIDDEN' NAME='filename' VALUE=""/>
<INPUT TYPE='HIDDEN' NAME='nomcuestionario'>
<xsl:attribute name="VALUE"><xsl:value-of select="@nombre"/></xsl:attribute>
</INPUT>
</FORM>
</body>
</html>
</xsl:template>
<xsl:template match="VARIABLE">
</xsl:template>
<xsl:template match="SECCION">
<p class="subtit2"><xsl:value-of select="@nombre"/></p>
<br/>
	 <xsl:apply-templates/>	 
</xsl:template>
<xsl:template match="CABECERATABLA">
<xsl:value-of select="VACIO"/>
<table border='1'>
<tr>
<td>___________</td>
<td> Pasado </td>
<td> Presente </td>
</tr>
<tr>
<td><xsl:value-of select="TEXTO"/></td>
<td><xsl:value-of select="CUESTION3DECISION"/></td>
<td></td>
</tr>
</table>
</xsl:template>
 
<xsl:template match="VACIO"> 
<xsl:apply-templates/>
</xsl:template>
 
<xsl:template match="CUESTION3DECISION">
<p><xsl:value-of select="TEXTO"/></p>
<p> 
<INPUT TYPE="RADIO">
<xsl:attribute name="NAME">cuestest<xsl:value-of select="@NUMERO"/></xsl:attribute> 
<xsl:attribute name="ID">cuestest<xsl:value-of select="@NUMERO"/>_<xsl:eval>childNumber(this)</xsl:eval></xsl:attribute> 
<xsl:attribute name="onclick">alert('hola');</xsl:attribute>	 
</INPUT> 
NA/Sin INF
<INPUT TYPE="RADIO">
<xsl:attribute name="NAME">cuestest<xsl:value-of select="@NUMERO"/></xsl:attribute> 
<xsl:attribute name="ID">cuestest<xsl:value-of select="@NUMERO"/>_<xsl:eval>childNumber(this)</xsl:eval></xsl:attribute> 
<xsl:attribute name="onclick">alert('adios');</xsl:attribute>
</INPUT>	 
NO
<INPUT TYPE="RADIO">
<xsl:attribute name="NAME">cuestest<xsl:value-of select="@NUMERO"/></xsl:attribute> 
<xsl:attribute name="ID">cuestest<xsl:value-of select="@NUMERO"/>_<xsl:eval>childNumber(this)</xsl:eval></xsl:attribute> 
<xsl:attribute name="onclick">alert('caracol');</xsl:attribute>
</INPUT>	 
SI
</p>
</xsl:template>
 
<xsl:template match="TEXTO"> 
<P class="texto"><xsl:apply-templates/></P>
</xsl:template>
</xsl:stylesheet>
__________________
---Nuestra recompensa se encuentra en el esfuerzo y no en el resultado. Un esfuerzo total es una victoria completa.-- GHANDI
  #2 (permalink)  
Antiguo 23/09/2005, 12:00
 
Fecha de Ingreso: abril-2004
Ubicación: Juli - Puno - Perú
Mensajes: 51
Antigüedad: 20 años
Puntos: 0
Hola,
Creo que no estás invocando correctamente a los nodos del documento XML.
Corrige de esta manera:
Código:
<xsl:template match="CABECERATABLA">
...
<tr>
<td><xsl:value-of select="TEXTO"/></td>
<td><xsl:apply-templates select="CUESTION3DECISION"/></td>
<td></td>
</tr>
</table>
</xsl:template>
 
<xsl:template match="CUESTION3DECISION">
<p><xsl:value-of select="PREGUNTA"/></p>
<p> 
<INPUT TYPE="RADIO">
...
</p>
</xsl:template>
con esto debería funcionarte.

Saludos
__________________
Juli - La Pequeña Roma Aymara
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:54.