Transforming an XML with XSL. Encoding problems

O

OKI

Hi.

I have this XML and XSL:

SALDO.XML
=========
<?xml-stylesheet type="text/xsl" href="saldo.xsl"
encoding="iso-8859-1" ?>
<Operacion tipo="Saldo Tarjetas" res="ERROR">
<Datos/>
<CodError>2</CodError>
<Descripcion>El número de dígitos de la tarjeta ha de ser
4</Descripcion>
</Operacion>

SALDO.XSL
=========
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="xml" />
<xsl:template match="/">
<CiscoIPPhoneText>
<Text>
<xsl:choose>
<xsl:when test="Datos == ''">
<xsl:value-of select="Descripcion"/>
</xsl:when>

<xsl:eek:therwise>
<xsl:value-of select="Datos"/>
</xsl:eek:therwise>
</xsl:choose>
</Text>
</CiscoIPPhoneText>
</xsl:template>
</xsl:stylesheet>

My problem is that when I´ve tried to open SALDO.XML in Internet
Explorer, all I have is a parser error in "<Descripcion>El nú"

How can I do for making the transformation? I´ve tried different
encoding but I hadn´t have any result

thanks
 
R

Rolf Magnus

OKI said:
Hi.

I have this XML and XSL:

SALDO.XML
=========
<?xml-stylesheet type="text/xsl" href="saldo.xsl"
encoding="iso-8859-1" ?>
<Operacion tipo="Saldo Tarjetas" res="ERROR">
<Datos/>
<CodError>2</CodError>
<Descripcion>El número de dígitos de la tarjeta ha de ser
4</Descripcion>
</Operacion>

SALDO.XSL
=========
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="xml" />
<xsl:template match="/">
<CiscoIPPhoneText>
<Text>
<xsl:choose>
<xsl:when test="Datos == ''">
<xsl:value-of select="Descripcion"/>
</xsl:when>

<xsl:eek:therwise>
<xsl:value-of select="Datos"/>
</xsl:eek:therwise>
</xsl:choose>
</Text>
</CiscoIPPhoneText>
</xsl:template>
</xsl:stylesheet>

My problem is that when I?ve tried to open SALDO.XML in Internet
Explorer, all I have is a parser error in "<Descripcion>El nú"

You need to put the encoding attribute into an xml declaration:

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="saldo.xsl"?>
<Operacion tipo="Saldo Tarjetas" res="ERROR">
<Datos/>
<CodError>2</CodError>
<Descripcion>El número de dígitos de la tarjeta ha de ser
4</Descripcion>
</Operacion>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top