Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSLT disable-output-escaping

Reply
Thread Tools

XSLT disable-output-escaping

 
 
Lisa
Guest
Posts: n/a
 
      07-07-2004
I need to apply the HTML formatting tags and the French accented
characters in a XML document. The XML is generated from a database
that has HTML tags and French accented characters in the records.

I have specified <xslutput method="html"/> and
encoding="iso-8859-1".

When I apply the xsl:value-of and set the disable-output-escaping to
"yes", the HTML formatting tags are displayed correctly, but the
French accented characters are displayed as "?". If I set the
disable-output-escaping to "yes", the French accented characters are
displayed properly, but not the HTML formatting tags. The HTML
formatting tags are output as &lt;...&gt; and display <..> in the
browser (e.g. <p>)

Any suggestion that how I can display both HTML formatting tag and
French accented characters properly …


Thanks in advance,


Lisa
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      07-07-2004


Lisa wrote:

> I need to apply the HTML formatting tags and the French accented
> characters in a XML document. The XML is generated from a database
> that has HTML tags and French accented characters in the records.
>
> I have specified <xslutput method="html"/> and
> encoding="iso-8859-1".
>
> When I apply the xsl:value-of and set the disable-output-escaping to
> "yes", the HTML formatting tags are displayed correctly, but the
> French accented characters are displayed as "?". If I set the
> disable-output-escaping to "yes", the French accented characters are
> displayed properly, but not the HTML formatting tags. The HTML
> formatting tags are output as &lt;...&gt; and display <..> in the
> browser (e.g. <p>)
>
> Any suggestion that how I can display both HTML formatting tag and
> French accented characters properly …


I am not sure what you want to achieve, if you have an XSLT question
consider to give an example of your XML input data and in particular
tell us how it is encoded, then show the relevant XSLT you are having
problem with together with the XSLT output (which you have above).

I don't see any problem to for instance take the following XML

<?xml version="1.0" encoding="UTF-8"?>
<root>
<text xml:lang="en">I am tired.</text>
<text xml:lang="fr">Je suis fatigué.</text>
<text xml:lang="de">Ich bin müde.</text>
</root>

and transform it with the following XSLT stylesheet

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlnssl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xslutput method="html" encoding="ISO-8859-1" />

<xsl:template match="/">
<html lang="en">
<head>
<title>A text in Englisch, French, and German</title>
</head>
<body>
<xsl:apply-templates select="root/text" />
</body>
</html>
</xsl:template>

<xsl:template match="text">
<p>
<xsl:attribute name="lang">
<xsl:choose>
<xsl:when test="lang('en')"><xsl:text>en</xsl:text></xsl:when>
<xsl:when test="lang('fr')"><xsl:text>fr</xsl:text></xsl:when>
<xsl:when test="lang('de')"><xsl:text>de</xsl:text></xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="." />
</p>
</xsl:template>

</xsl:stylesheet>

to the following HTML output:

<html lang="en">
<head>
<META http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>A text in Englisch, French, and German</title>
</head>
<body>
<p lang="en">I am tired.</p>
<p lang="fr">Je suis fatigu&eacute;.</p>
<p lang="de">Ich bin m&uuml;de.</p>
</body>
</html>

Of course the XSLT processor could as well serialize the output as

<html lang="en">
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>A text in Englisch, French, and German</title>
</head>
<body>
<p lang="en">I am tired.</p>
<p lang="fr">Je suis fatigué.</p>
<p lang="de">Ich bin müde.</p>
</body>
</html>

but that doesn't matter to a browser/user agent.


That might not be your problem but you haven't really shown us what your
input looks like, I suspect you are dealing with HTML markup in your
input which you try to process as text instead processing them as
elements but we can only help if you show a sample of the input.

--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Including XSLT/XML document within a XSLT document dar_imiro@hotmail.com XML 4 12-13-2005 02:26 AM
Multiple XSLT Transforms using a Controller XSLT sneill@mxlogic.com XML 2 10-19-2005 11:00 AM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
xslt alone or xslt/java for static site? ted XML 1 01-26-2004 10:41 AM
[XSLT]Passing values from Javascript to a XSLT variable Benjamin Hillsley XML 3 09-25-2003 04:50 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57