 |
| 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
|
|
|
|

January 12th, 2006, 12:13 PM
|
|
Registered User
|
|
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 12th, 2006, 12:49 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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). £ 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
|
|

January 12th, 2006, 01:35 PM
|
|
Registered User
|
|
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 12th, 2006, 02:01 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

January 17th, 2006, 03:17 PM
|
|
Registered User
|
|
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|
|

January 17th, 2006, 03:47 PM
|
|
Registered User
|
|
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

January 17th, 2006, 05:24 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

January 17th, 2006, 05:26 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|

January 18th, 2006, 06:11 AM
|
|
Registered User
|
|
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|
|

January 18th, 2006, 07:34 AM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 71
Thanks: 10
Thanked 0 Times in 0 Posts
|
|
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
|
|
 |