473,395 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XSLT disable-output-escaping

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 <xsl:output 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
Jul 20 '05 #1
1 5545


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 <xsl:output 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
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output 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/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ted | last post by:
Was wondering if XSLT alone is appropriate for the following situation. From XML, I'm creating a small website (around 50 pages) with pages that link to each other through a nav menu and a...
2
by: Tom Corcoran | last post by:
I am working to ease updating of a html page by transforming 2 xml files. I was going to use xslt for this and had bought 2 unopened books, wrox xslt and o'reilly's xslt cookbook. But am now...
1
by: Mohit | last post by:
Hi Friends I have to call 1 of the 2 child XSLT files from the Main XSLT file based on some criteria. I want one child XSLT file will be executed by version 1 of XSLT processor and the other by...
4
by: Ringo Langly | last post by:
Hi all, I'm a seasoned web programmer, but I've never touched XSLT. It's always been one of those acronyms I've never needed to educate myself on. Now... we're working with a web content...
3
by: Jack Fox | last post by:
I've never had the need to work with XML, but I believe I now have an appropriate application. I have time-series data in objects organized as a tree that I want an ASP.NET program to write out to...
1
by: jwalton | last post by:
Sorry if slightly off-topic, but I have asked / researched many other places already, maybe someone here can help? MSIE has a useful (for users applications) feature of performing XSLT...
3
by: Ian Roddis | last post by:
Hello, I want to embed SQL type queries within an XML data record. The XML looks something like this: <DISPLAYPAGE> <FIELD NAME="SERVER" TYPE="DROPDOWN"> <OPTION>1<OPTION> <OPTION>2<OPTION>...
1
by: Sergey Dubinets | last post by:
In effort to prioritize our goals we composed the list of random features each of them may add value to set of XSLT tools offered from Microsoft. 1. XSLTc (Compiler for XSLT...
12
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I...
2
by: Ronald Raygun | last post by:
I am running a build process (using propel) which requires XSLT for some transformations. I get the following error: "Could not perform XLST transformation. Make sure PHP has been...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.