Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 12th, 2006, 12:13 PM
Registered User
 
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default pound symbol in XSL


Hello,

Could you please tell me how can i print out the pound symbol in XSLT?
I've tried the HTML entities £ #163; #xA3; but neither of them worked.
My stylesheet tag is:
<xsl:stylesheet version="1.0" encoding="ISO-8589" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

Is it because of the encoding?

Thank you,
Velissarios Krinis
 
Old January 12th, 2006, 12:49 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Assuming you mean the "pound sterling" symbol (£), and not the hash (#) sign which some Americans refer to as a pound sign, you can enter it in your stylesheet using the XML character reference #xa3; (that's & # x a 3 ; in case of email corruptions). &pound; is defined only in HTML, not in XML (unless you define it yourself in your DTD).

Your encoding could well cause problems, I think you meant ISO-8859-1 not ISO-8589. However, the encoding doesn't affect the interpretation of numeric character references, which always use Unicode code values, regardless of the encoding of the file.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 12th, 2006, 01:35 PM
Registered User
 
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the answer. I still have the problem though. As I mentioned at my first post, I have already tried the #xa3; reference.

Velissarios Krinis

 
Old January 12th, 2006, 02:01 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Well, we can only help you with the problem if you tell us what it is.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 17th, 2006, 03:17 PM
Registered User
 
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am also experiencing this problem. My encoding is set to ISO-8859-1 and i am using #163; to specify the pound sign. It is displaying as a ? in IE but when i look at the source in the browser it has been shows a £ character.

I have used the same code in other applications and it works fine. I cannot see why it should be different other than the working code is being displayed in a iframe.

Any ideas?

 
Old January 17th, 2006, 03:47 PM
Registered User
 
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

On closer inspection i noticed that the working code is being applied by the browser whereas the faulty code is being processed server side in asp using Msxml2.DOMDocument.3.0 and the transformNode method.

I am assuming that IE and IIS are both using the same version of msxml as they are both running on my laptop.



 
Old January 17th, 2006, 05:24 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It looks like a browser or web server issue rather than an XSLT issue. I'm no expert on this. Are you loading the file directly into IE, or via a web server? In the latter case it could be some kind of misconfiguration at the server causing the HTTP headers to be wrong. I think there are also possible IE configuration issues. What does the <meta> tag in the HTML (generated) source say about the encoding?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 17th, 2006, 05:26 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If you use transformNode(), remember that the serialization is being done by the DOM processor and not by the XSLT processor, so anything you say in xsl:output is likely to be ignored.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 18th, 2006, 06:11 AM
Registered User
 
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The XML is being generated by an asp application from a SQLServer db in both cases. For browser side processing the app is inserting a <?xml-stylesheet type="text/xsl" href="prodpandp.xsl" ?> statement into the XML in which case the #163; gets correctly rendered.

For server side the same xsl file gets loaded into MSxml2 and run to produce the html output.

I cannot view the html source produced by the browser but for the second case it produces the following header that doesnt work
<html xmlns:xalan="http://xml.apache.org/xslt">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">

How can I control the encoding server side?



 
Old January 18th, 2006, 07:34 AM
Authorized User
 
Join Date: Dec 2005
Posts: 71
Thanks: 10
Thanked 0 Times in 0 Posts
Default

Hi All,

I think, I was also experiencing as same problem.

Source XML
---------------
<fname>Bálá </fname> <lname>Krishnan</lname>


Used XSL
-------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:character-map name="isolat1">
<xsl:output-character character="á" string="á"/>
</xsl:character-map>
</xsl:stylesheet>

Output XML
---------------
<fname>Bálá </fname> <lname>Krishnan</lname>


Expected XML
------------------
<fname>Bálá </fname> <lname>Krishnan</lname>

Thanks & Regards,
-ROCXY







Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL: Currency symbol Euro elayaraja.s XSLT 2 August 12th, 2008 03:00 AM
entering £ (pound sign) into MySQL database - PHP crmpicco PHP Databases 1 November 14th, 2007 02:02 AM
pound sign and querystring ricespn Classic ASP Basics 3 October 19th, 2006 09:24 AM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.