Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Ajax - xml -xslt

Estas en el tema de Ajax - xml -xslt en el foro de Frameworks JS en Foros del Web. Buenas tardes, Tengo una situacion que no he podido resolver: Cargo un xsl con un ajax pero cuando trato de cargar y analizar con el ...
  #1 (permalink)  
Antiguo 22/12/2008, 15:23
 
Fecha de Ingreso: diciembre-2008
Mensajes: 4
Antigüedad: 15 años, 5 meses
Puntos: 0
Ajax - xml -xslt

Buenas tardes,

Tengo una situacion que no he podido resolver:
Cargo un xsl con un ajax pero cuando trato de cargar y analizar con el metodo load() la hoja de estio siempre me saca el mismo error:
XML document must have a top level element
o en español El documento debe tener un elemento de nivel superior. Muchas Gracias.

Muestro el llamado (ajax) , la funcion que procesa la respuesta de éste y el XSL:

function realizarPeticionAlServidorCargarHojaEstiloXslTarea s(metodo,url,funcion)
{

if (objetoXmlHttpHojaEstiloXslTareas)
{
objetoXmlHttpHojaEstiloXslTareas.onreadystatechang e = funcion; // Cuando la aplicación reciba la respuesta del servidor, se debe ejecutar la función procesarCombox().
objetoXmlHttpHojaEstiloXslTareas.open(metodo,url,f alse); // Crear petición HTTP. true indica una conexión asíncrona
objetoXmlHttpHojaEstiloXslTareas.send(null); // send() requiere de un parámetro que indica la información que se va a enviar al servidor junto con la petición HTTP. Si no se envían datos, se debe indicar un valor igual a null. En otro caso, se puede indicar como parámetro una cadena de texto, un array debytes o un objeto XML DOM.
}
else
{
alert (MENSAJE_NOTIFICACION_001_BR);
}


procesarRespuestaServidorCargarHojaEstiloXslTareas ();


}


function procesarRespuestaServidorCargarHojaEstiloXslTareas ()
{

var respuestaXmlResponseText;
var respuestaXmlResponseXml;


//Se comprueba que se ha recibido la respuesta del servidor
if (objetoXmlHttpHojaEstiloXslTareas.readyState == LISTO_ESTADO_COMPLETADO ) {
// Se comprueba que la respuesta sea válida y correcta.
if (objetoXmlHttpHojaEstiloXslTareas.status == 200){
respuestaXmlResponseText = objetoXmlHttpHojaEstiloXslTareas.responseText;
respuestaXmlResponseXml = objetoXmlHttpHojaEstiloXslTareas.responseXml;


if (window.DOMParser) // browsers with native functionality
{

var domParser;

domParser = new DOMParser();
documentoHojaEstilo = domParser.parseFromString(respuestaXmlResponseText , "text/xml");

}
else
{
if (window.ActiveXObject) // Internet Explorer?
{

documentoHojaEstilo = createMsxml2DOMDocumentObject();
documentoHojaEstilo.async = false;
documentoHojaEstilo.load(respuestaXmlResponseXml);
}
}
}
}
}


------------------------------
La hoja XSL es la siguiente:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">

<table border="0" align="center">
<tr>
<th>
<label style="font-weight: bold; font-size: .85em; color: #002469" >Descripción Tarea </label>
</th>
<th>
<label style="font-weight: bold; font-size: .85em; color: #002469">Placa Vehiculo</label>

</th>
<th>
<label style="font-weight: bold; font-size: .85em; color: #002469">Chasis Vehiculo</label>
</th>
</tr>

<xsl:for-each select = "Tareas/Tarea">
<tr>
<td>
<input type="text" readonly="readonly">
<xsl:attribute name="id">
<xsl:value-of select="htmldescripciontarea" />
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="htmldescripciontarea" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="descripciontarea" />
</xsl:attribute>

</input>
</td>

<td>

<input type="text" readonly="readonly">
<xsl:attribute name="id">
<xsl:value-of select="htmlplaca" />
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="htmlplaca" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="placa" />
</xsl:attribute>
</input>

</td>
<td>

<input type="text" readonly="readonly">
<xsl:attribute name="id">
<xsl:value-of select="htmlchasis" />
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="htmlchasis" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="chasis" />
</xsl:attribute>
</input>

</td>
<td>

<input type="text" style="visibility: hidden">
<xsl:attribute name="id">
<xsl:value-of select="htmltarea" />
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="htmltarea" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="identificadortarea" />
</xsl:attribute>
</input>

</td>


<td>

<input type="submit" value="Agendar">

<xsl:attribute name="id">
<xsl:value-of select="htmlbotonagendar" />
</xsl:attribute>

<xsl:attribute name="name">
<xsl:value-of select="htmlbotonagendar" />
</xsl:attribute>

</input>

</td>
<td>
<input type="submit" value="Imprimir">

<xsl:attribute name="id">
<xsl:value-of select="htmlbotonimprimir" />
</xsl:attribute>

<xsl:attribute name="name">
<xsl:value-of select="htmlbotonimprimir" />
</xsl:attribute>

</input>
</td>

</tr>

</xsl:for-each>

</table>

</xsl:template>

</xsl:stylesheet>
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 08:58.