Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
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 November 6th, 2006, 09:12 AM
Authorized User
Points: 345, Level: 6
Points: 345, Level: 6 Points: 345, Level: 6 Points: 345, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 71
Thanks: 10
Thanked 0 Times in 0 Posts
Default saxon:character-representation="decimal"

Dear All,

I came across a problem during converting the Character entity to Numerical entity.

Used XSLT:
<xsl:output method="xml" encoding="US-ASCII" saxon:character-representation="decimal" omit-xml-declaration="yes" />

XML Output:
"—" (i.e. mdash) --> "# 8212 ;"

Required XML Output:
"—" (i.e. mdash)--> "# 151 ;" [ASCII (decimal)]

Any help would be thank full.

Regards,
ROCXY

__________________
Thanks,
Rocxy.
 
Old November 6th, 2006, 09:35 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Numerical character references in XML are always Unicode code points. The Unicode code point for emdash is 8212. It's encoded as 151, I believe, in some Microsoft code-page; but that's immaterial. The Unicode code point 151 represents a control character. It's legal to have # 151 in an XML document but it doesn't represent an emdash. If you really want to output this character you could do it by writing

<xsl:text>#151;</xsl:text>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old November 9th, 2006, 04:09 AM
Authorized User
 
Join Date: Jun 2006
Location: Chennai, tamilnadu, India.
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Dear All,

The Unicode point for emdash is 8212 but it encoded as 151 in Microsoft code-page. Is there any list available like this? so that i can hard-code it.
Any help would be thank full.

Regards,
RICHBIRD

 
Old November 9th, 2006, 05:23 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Why do you need to hard code it? Even though this encoding is Microsoft-proprietary, many XSLT processors are likely to support it if you request <xsl:output encoding="cp1252"/>

Google for "cp1252 Unicode mapping" to find the conversion tables.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference




Similar Threads
Thread Thread Starter Forum Replies Last Post
String representation in .NET ashooagarwal .NET Framework 1.x 0 July 2nd, 2007 09:12 PM
array representation malli_kv2 Java Basics 2 March 20th, 2007 11:05 PM
decimal data type all 0's after decimal gobotsoup SQL Server ASP 1 February 28th, 2007 02:32 PM
SAXON Ques dev.user06 XSLT 4 July 26th, 2006 10:44 AM
Decimal code for a special character mcinar HTML Code Clinic 14 February 4th, 2005 01:56 PM





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