Subject: Re: [xsl] Error at element constructor... From: SEXpeare <sexpeare@xxxxxxxxx> Date: Mon, 12 Mar 2007 11:18:05 +0100 |
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/> <xsl:template match="/boletin"> <boletin> <info> <xsl:choose> <xsl:when test="IsSuplemento = "No""> <tipo>Boletmn</tipo> </xsl:when> <xsl:otherwise> <tipo>Suplemento</tipo> </xsl:otherwise> </xsl:choose> <xsl:for-each select="VariableTexts/VariableText/VarName[. = "NumBopa"]"> <numero> <xsl:value-of select="../VarText"/> </numero> </xsl:for-each> <xsl:for-each select="VariableTexts/VariableText/VarName[. = "NumSuplemento"]"> <numeroSuplemento> <xsl:value-of select="../VarText"/> </numeroSuplemento> </xsl:for-each> <xsl:for-each select="VariableTexts/VariableText/VarName[. = "FechaCabecera"]"> <fecha> <xsl:value-of select="../VarText"/> </fecha> </xsl:for-each> <xsl:for-each select="StartPageNum"> <paginaInicio> <xsl:apply-templates/> </paginaInicio> </xsl:for-each> <numPaginas/> </info> <sumario> <xsl:for-each select="sumario/seccion[1]"> <xsl:call-template name="sumario"/> </xsl:for-each> </sumario> <anuncios> <xsl:for-each select="anuncios/p[1]"> <xsl:call-template name="anuncios"/> </xsl:for-each> </anuncios> </boletin> </xsl:template>
<xsl:template name="sumario"> <xsl:variable name="name" select="name()"/> <xsl:for-each-group select="self::* | following-sibling::*" group-starting-with="*[name() = $name]"> <xsl:copy> <xsl:choose> <xsl:when test="name() != "anuncio""> <xsl:copy-of select="@*"/> </xsl:when> <xsl:otherwise> <codigo/> <titulo> <xsl:value-of select="@txt"/> </titulo> <paginaInicio/> <paginaFin/> </xsl:otherwise> </xsl:choose> <xsl:variable name="group"> <xsl:copy-of select="current-group()"/> </xsl:variable> <xsl:for-each select="$group/*[2]"> <xsl:call-template name="sumario"/> </xsl:for-each> </xsl:copy> </xsl:for-each-group> </xsl:template>
<xsl:template name="anuncios"> <xsl:variable name="estilo" select="@style"/> <xsl:for-each-group select="self::* | following-sibling::*" group-starting-with="*[@style = $estilo]"> <xsl:choose>
<xsl:when test="@style = "0GEN_Tit_Seccion""> <seccion id="{.}"> <xsl:variable name="group"> <xsl:copy-of select="current-group()"/> </xsl:variable> <xsl:for-each select="$group/*[2]"> <xsl:call-template name="anuncios"/> </xsl:for-each> </seccion> </xsl:when>
<xsl:when test="@style = "1PA_Tit1_SubSecc""> <subseccion id="{.}"> <xsl:variable name="group"> <xsl:copy-of select="current-group()"/> </xsl:variable> <xsl:for-each select="$group/*[2]"> <xsl:call-template name="anuncios"/> </xsl:for-each> </subseccion> </xsl:when>
<xsl:when test="@style = "1PA_Tit2_Consejeria""> <organismo id="{.}"> <xsl:variable name="group"> <xsl:copy-of select="current-group()"/> </xsl:variable> <xsl:for-each select="$group/*[2]"> <xsl:call-template name="anuncios"/> </xsl:for-each> </organismo> </xsl:when>
<xsl:when test="@style = "XXXXXXXXXXXXXXXXXXXSUBORGANISMOXXXXXXXXXXXXXXXXXXX""> <suborganismo id="{.}"> <xsl:variable name="group"> <xsl:copy-of select="current-group()"/> </xsl:variable> <xsl:for-each select="$group/*[2]"> <xsl:call-template name="anuncios"/> </xsl:for-each> </suborganismo> </xsl:when>
<xsl:when test="following-sibling::*[1]/@style = "1PA_Sum_Anuncio""> <xsl:variable name="group"> <xsl:copy-of select="current-group()"/> </xsl:variable> <xsl:for-each select="$group/*[2]"> <xsl:call-template name="anuncios"/> </xsl:for-each> </xsl:when>
<xsl:when test="@style = "1PA_Sum_Anuncio""> <anuncio> <infoAnuncio> <codigo><xsl:value-of select="preceding-sibling::adstart[1]/@TextId"/></codigo> <titulo><xsl:value-of select="substring(., 2)"/></titulo> <paginaInicio></paginaInicio> <paginaFin></paginaFin> <tipoAnuncio></tipoAnuncio> </infoAnuncio> <contenido> </contenido> </anuncio> </xsl:when>
</xsl:choose> </xsl:for-each-group> </xsl:template> </xsl:stylesheet>
it's> The error appears in line 5, so I don't think the rest of the > xsl has to do with the error.
At the very least, you should show us the whole of the instruction that
complaining about, that is, the <info> element. It might also be necessary to look at functions or templates called from that instruction. I suggested that it might have something to do with a call on document() so it would be useful to know if there are any such calls and if so, what they look like.
When you snip code from a posting, you don't only need to convince yourself that the code you've snipped is irrelevant to the problem, you need to convince your readers too...
Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Error at element construc, Michael Kay | Thread | RE: [xsl] Error at element construc, Michael Kay |
RE: [xsl] Error at element construc, Michael Kay | Date | RE: [xsl] Error at element construc, Michael Kay |
Month |