[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Trouble transforming special characters

Subject: Re: Trouble transforming special characters
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Tue, 10 Aug 2010 17:42:59 +0200
Re:  Trouble transforming special characters
Craig Whisenhunt wrote:
Hello,

I am transforming XML to HTML. The XML source has:

Pe&ntilde;a

which should transform and display as Peqa.

Instead, the '&ntilde;' gets transformed into a '?'.

Same problem with mdash

Processor Information:
XSL version: 1
Vendor: Microsoft
Vendor URL: http://www.microsoft.com

Using VS2008, C#, .NET 3.5

My XSLT begins with:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:space="default"
xmlns:l="urn::tlc.state.tx.us.salsa.legdoc">
  <xsl:output method="html" encoding="UTF-8" use-character-maps="cm1"
indent="yes"/>
  <xsl:character-map name="cm1">
    <xsl:output-character character="&#160;" string="&amp;nbsp;"/>
    <xsl:output-character character="&#8212;" string="&amp;mdash;"/>
    <xsl:output-character character="&#233;" string="&amp;eacute;"/>
    <xsl:output-character character="&#241;" string="&amp;ntilde;"/>
  </xsl:character-map>


Note that when I do the transformation in XMLSpy, it works fine. Using
it in code, though, produces a '?'.

I think I did explain elsewhere that XML Spy supports XSLT 2.0 (i.e xsl:character-map) while XslCompiledTransform is an XSLT 1.0 processor that does not support any XSLT 2.0 constructs.
If you want to use XSLT 2.0 with .NET code then use Saxon 9 (http://saxon.sourceforge.net/) or use AltovaXML tools (http://www.altova.com/altovaxml.html).



--


	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.