all. I have a really big problem i want to ask for info, please. Ive got a project in java, one of the functions of this proyect, is that have to parse some xls. Well, ive got a problem while parsing one. This is the loop who parse the xsls:
while(itera.hasNext()){
// Creacion del transformador de SAX
tFactory.setErrorListener(new ManejadorXSLTErrores());
String nombrePlantilla = (String)itera.next();
//creamos el objeto transformer
String stream = (String)plantillas.get(nombrePlantilla);
if((stream!= null) && (getClass()!=null) && (getClass().getResourceAsStream(stream)!=null))
reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(stream)));
else
throw new ExceptionErrorARQSD(ConstantesErrorSD.ERROR_XML_TRANSFORMACION,new String[]{"Error al obtener el StreamSource: "+stream},null);
transformer = tFactory.newTemplates(new StreamSource(reader));
//se guardan en un contenedor
contenedortransformers.putElemento(nombrePlantilla,transformer);
}
And this is part of the xsd of my excel:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xalan="http://xml.apache.org/xslt">
<xsl:param name="servicio">
<xsl:value-of select="normalize-space(/SD/MENSAJECM/contenedorPeticionDatosComunes/codigoServicio)"/>
</xsl:param>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="SD">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="MENSAJECM">
<xsl:if test="$servicio = 'NSPLA001'">
<xsl:element name="MensajeSolicitud">
<xsl:apply-templates/>
</xsl:element>
</xsl:if>
<xsl:if test="$servicio = 'NSPLA002'">
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
<xsl:template match="contenedorPeticionDatosComunes">
<xsl:if test="$servicio = 'NSPLA001'">
<xsl:param name="fecha"><xsl:value-of select="normalize-space(./fecha)"/></xsl:param>
<xsl:param name="hora"><xsl:value-of select="normalize-space(./hora)"/></xsl:param>
<!-- Cod. Entidad U.O.R. (csbc) -->
<xsl:attribute name="csbc">
<xsl:value-of select="substring(./unidadOrganizativaResponsable,1,4)"/>
</xsl:attribute>
<xsl:attribute name="fecha_envio">
<xsl:value-of select="$fecha"/>
</xsl:attribute>
<xsl:attribute name="oficina">
<xsl:value-of select="substring(./unidadOrganizativaResponsable,5,4)"/>
</xsl:attribute>
<xsl:attribute name="terminal">
<xsl:value-of select="substring(./unidadOrganizativaResponsable,11,2)"/>
</xsl:attribute>
<xsl:attribute name="usuario">
<xsl:value-of select="./usuario"/>
</xsl:attribute>
<xsl:attribute name="version">
<xsl:value-of select="1.0"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
This is the exception that i receive:
javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: org.xml.sax.SAXException: ¡xsl:param no está permitido en esta posición de la hoja de estilos!
javax.xml.transform.TransformerException: ¡xsl:param no está permitido en esta posición de la hoja de estilos!
Anyone can help me??? Thanks