472,958 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 5508


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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.