473,573 Members | 2,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display special characters in XSL

Hi,

I have a XML file which looks like this.

<article_conten t id="364098" status="A">
<title>Weekly Sector Review</title>
<date>2004100 8</date>
<time>09:11:0 0</time>
<body>BP’s third quarter figures were well received with
investors cheering the prospect of enormous profits this year and
possibly more to come with oil prices remaining stubbornly high.
<introduction>W eekly review of the biggest sector
movers</introduction>
<category_id>01 00</category_id>
</article_content >

How can make so that the XSL will display the character ’ as '
in the HTML page?

Thanks a lot

GA
Jul 20 '05 #1
5 13000
On 9 Oct 2004 05:14:07 -0700, ga************@ hotmail.com (Gaizka)
wrote:
How can make so that the XSL will display the character ’ as '
in the HTML page?


XSL doesn't "display" things, it just makes another output document,
typically as either HTML or XML. It's default behaviour will be to
generate ’ in the output, exactly as for the input. For HTML,
this is perfectly adequate - ’ is valid,

In some obscure cases (I was bitten by this with Vodafone's
PaertnerML) ’ isn't acceptable. I had to whack it with some
JavaScript and a regex.
--
Smert' spamionam
Jul 20 '05 #2
Andy Dingley <di*****@codesm iths.com> wrote in message news:<g1******* *************** **********@4ax. com>...
On 9 Oct 2004 05:14:07 -0700, ga************@ hotmail.com (Gaizka)
wrote:
How can make so that the XSL will display the character ’ as '
in the HTML page?
XSL doesn't "display" things, it just makes another output document,
typically as either HTML or XML. It's default behaviour will be to
generate ’ in the output, exactly as for the input. For HTML,
this is perfectly adequate - ’ is valid,


ok the character in the XML file is &#8217 and I need transform it to
' in the HTML file

In some obscure cases (I was bitten by this with Vodafone's
PaertnerML) ’ isn't acceptable. I had to whack it with some
JavaScript and a regex.

Any other option than replacing it? :(

thanks

GA
Jul 20 '05 #3
On 11 Oct 2004 04:10:40 -0700, ga************@ hotmail.com (Gaizka)
wrote:
ok the character in the XML file is &#8217 and I need transform it to
' in the HTML file


Why ? Is it really not working ? - this entity ought to be perfectly
valid and workable in all cases, as a substitute for the character.

You can't really control this in XML. It's part of the fundamentals of
XML that the two representations are interchangeable , and so you don't
have control over it. If you wanted to, you would have to either
re-write or replace the XML serialiser that generates your output
document.

If you change the XSL output mode to text (or possibly HTML) then the
serialiser _may_ stop generating the entity, although this is platform
dependent.
You might find that you need to convert the "curly quote" to a
"straight quote". This is rare, but as mentioned, it does sometimes
arise.

If you want to substitute it, the XSL string function "translate( )"
should be able to help. Or else you can use a piece of JavaScript and
a regex. Place either in a named template rule and pass them the
text() content of the affected elements.
--
Smert' spamionam
Jul 20 '05 #4
ok the character in the XML file is &#8217 and I need transform it to
' in the HTML file


You mean you need a real ascii ' in the file or just that you want it to
display as that?
As others have said, & #8217; should just work. Apart form anything
else, if you are generating HTML I would expect most XSLT engines to
output it as & rsquo; as they usually use html entities where possible.

If you need to generate an ascii ' then you can use translate as in
<xsl:value-of select="transla te(.,'& #8217;',&quot;' &quot;)"/>

(without the space after the &) to replace any right quote characters in
the current element content.

David
Jul 20 '05 #5
Hi again and thanks for helpng this xml/xsl dummy :)

The XML feed contains &#8217 characters

i found out that, after the trasformation, n my tomcat development I see ' ... :)
In the production server I still see &#8217, and also ? instead of £ ... :(

is it Tomcat default encoding xml the difference?

many thanks

GA

David Carlisle <da****@nag.co. uk> wrote in message news:<yg******* ******@penguin. nag.co.uk>...
ok the character in the XML file is &#8217 and I need transform it to
' in the HTML file


You mean you need a real ascii ' in the file or just that you want it to
display as that?
As others have said, & #8217; should just work. Apart form anything
else, if you are generating HTML I would expect most XSLT engines to
output it as & rsquo; as they usually use html entities where possible.

If you need to generate an ascii ' then you can use translate as in
<xsl:value-of select="transla te(.,'& #8217;',&quot;' &quot;)"/>

(without the space after the &) to replace any right quote characters in
the current element content.

David

Jul 20 '05 #6

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

Similar topics

3
2420
by: mikel | last post by:
Hello, I have several characters in my html code like / W and so on.... The problem is, tehy are converted in HTML in their approbiate characters like @ is @ and F is F But I DONT want to display the F or the @ I want to display on my site the &# codes like @
7
8976
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP, mainly because I need the ability to both create and extract zip-files. I've tried a couple of classes found here and there, and they all seem to...
5
8606
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file". Same file path containing special characters works fine in one machine, but doesn't work in other. I am using following API function to get short...
17
30643
by: Carl Mercier | last post by:
Hi, Is it possible to use special characters like \n or \t in a VB.NET string, just like in C#? My guess is NO, but maybe there's something I don't know. If it's not possible, does anybody know of a VB.NET function (somebody must have coded this already) that will interpret strings containings those special characters, and handle them...
8
3652
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box and save it to a file. This step is not to hard however the contents of the textarea is mostly latex source so it contains just about every special...
11
11120
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in a text box. I know that there are certain control characters embedded in the data that I want to display substitutions for in the text box, for...
5
7508
by: iegeek | last post by:
Hi all, I know this is a well-worn topic, but in viewing multiple posts and articles, I still can't find a satisfactory answer. I have embedded html in an xml file (element data, not attributes) which I wish to display. --example of xml doc <footnotes type_num="5"> <footnote footHeaderValue="0" sub="0" br="0"...
1
4556
by: sonald | last post by:
Dear All, I am working on a module that validates the provided CSV data in a text format, which must be in a predefined format. We check for the : 1. Number of fields provided in the text file, 2. Text checks for max. length of the field & whether the field is mandatory or optional Example:
3
10187
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class. This is not a regular expression tutorial. Assumes you are already familiar with basic regular expression concepts and terminology. If not, you may want...
0
1972
by: AAaron123 | last post by:
Been playing with asp:changepassword and have it looking OK except that I can't elininate or change the title at the top that says "Change Your Password". It's a repeat of my pages title. But more importantly, I can't find the regular expression for at least 7 characters and at least 1 special character. Can you help?
0
7767
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7684
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8006
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7768
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6400
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5579
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2191
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1295
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1035
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.