RE: [xsl] Error at element constructor...

Subject: RE: [xsl] Error at element constructor...
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 12 Mar 2007 11:49:54 -0000
Thanks. Can't see any obvious cause there. Perhaps I took the wrong track
and it's actually the result destination it's got problems with. You wrote:

new StreamResult(xmlEstructurado)

What's in that variable?

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: SEXpeare [mailto:sexpeare@xxxxxxxxx]
> Sent: 12 March 2007 10:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Error at element constructor...
>
> Sorry for that man, here's the code:
>
> <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 = &quot;No&quot;">
> 						<tipo>Boletmn</tipo>
> 					</xsl:when>
> 					<xsl:otherwise>
> 						<tipo>Suplemento</tipo>
> 					</xsl:otherwise>
> 				</xsl:choose>
> 				<xsl:for-each
> select="VariableTexts/VariableText/VarName[. = &quot;NumBopa&quot;]">
> 					<numero>
> 						<xsl:value-of
> select="../VarText"/>
> 					</numero>
> 				</xsl:for-each>
> 				<xsl:for-each
> select="VariableTexts/VariableText/VarName[. =
> &quot;NumSuplemento&quot;]">
> 					<numeroSuplemento>
> 						<xsl:value-of
> select="../VarText"/>
> 					</numeroSuplemento>
> 				</xsl:for-each>
> 				<xsl:for-each
> select="VariableTexts/VariableText/VarName[. =
> &quot;FechaCabecera&quot;]">
> 					<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()
> != &quot;anuncio&quot;">
> 						<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>
>
> <!-- CASO SECCION -->
>
> 				<xsl:when test="@style =
> &quot;0GEN_Tit_Seccion&quot;">
> 					<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>
>
> <!-- FIN CASO SECCION -->
>
> <!-- CASO SUBSECCION -->
>
> 				<xsl:when test="@style =
> &quot;1PA_Tit1_SubSecc&quot;">
> 					<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>
>
> <!-- FIN CASO SUBSECCION -->
>
> <!-- CASO ORGANISMO -->
>
> 				<xsl:when test="@style =
> &quot;1PA_Tit2_Consejeria&quot;">
> 					<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>
>
> <!-- FIN CASO ORGANISMO -->
>
> <!-- CASO SUBORGANISMO -->
>
> 				<xsl:when test="@style =
> &quot;XXXXXXXXXXXXXXXXXXXSUBORGANISMOXXXXXXXXXXXXXXXXXXX&quot;">
> 					<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>
>
> <!-- FIN CASO SUBORGANISMO -->
>
> <!-- CASO ADSTART (NO SE MUESTRA) -->
>
> 				<xsl:when
> test="following-sibling::*[1]/@style = &quot;1PA_Sum_Anuncio&quot;">
> 					<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>
>
> <!-- FIN CASO ADSTART -->
>
> <!-- CASO ANUNCIO -->
>
> 				<xsl:when test="@style =
> &quot;1PA_Sum_Anuncio&quot;">
> 					<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>
>
> <!-- FIN CASO ANUNCIO -->
>
> 			</xsl:choose>
> 		</xsl:for-each-group>
> 	</xsl:template>
> </xsl:stylesheet>
>
> 2007/3/12, Michael Kay <mike@xxxxxxxxxxxx>:
> > > 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 it's 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