[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Error at element constructor...
Subject: Re: Error at element constructor...
From: SEXpeare <sexpeare@xxxxxxxxx>
Date: Mon, 12 Mar 2007 13:02:05 +0100
|
xmlEstructurado is a String object initialized with "", I forgot to
put one code line in my first post, the code is this (again):
String xmlEstructurado = "";
System.setProperty("javax.xml.transform.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl");
TransformerFactory tfactory =
TransformerFactory.newInstance();
File plantilla = new File("c:/prueba.xsl");
StreamSource xslSrc = new
StreamSource(plantilla.toURL().openStream());
xslSrc.setSystemId("c:/");
StreamSource xmlSrc = new
StreamSource(super.getISFromDH(adjuntoXml));
xmlSrc.setSystemId("c:/");
Transformer transformer = tfactory.newTransformer(xslSrc);
transformer.transform(xmlSrc, new
StreamResult(xmlEstructurado));
If I call setSystemId for the result, the error changes to this one:
java.lang.IllegalArgumentException: URI scheme is not "file"
2007/3/12, Michael Kay <mike@xxxxxxxxxxxx>:
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: 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 = "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>
>
> <!-- CASO SECCION -->
>
> <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>
>
> <!-- FIN CASO SECCION -->
>
> <!-- CASO SUBSECCION -->
>
> <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>
>
> <!-- FIN CASO SUBSECCION -->
>
> <!-- CASO ORGANISMO -->
>
> <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>
>
> <!-- FIN CASO ORGANISMO -->
>
> <!-- CASO SUBORGANISMO -->
>
> <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>
>
> <!-- FIN CASO SUBORGANISMO -->
>
> <!-- CASO ADSTART (NO SE MUESTRA) -->
>
> <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>
>
> <!-- FIN CASO ADSTART -->
>
> <!-- CASO ANUNCIO -->
>
> <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>
>
> <!-- 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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|