472,980 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,980 software developers and data experts.

XslCompiledTransform

Hi

I am trying to exexute a transform (XslCompiledTransform .Transform), but
get this exception:

System.Text.EncoderFallbackException: Unable to translate Unicode character
\u2013 at index 3637 to specified code page.
at System.Text.EncoderExceptionFallbackBuffer.Fallbac k(Char charUnknown,
Int32 index)
at System.Xml.CharEntityEncoderFallbackBuffer.Fallbac k(Char charUnknown,
Int32 index)
....
What exactly is the cause of this, and how can I avoid it?

Thanks,
Peter
Oct 13 '06 #1
3 7912


Peter Kirk wrote:

I am trying to exexute a transform (XslCompiledTransform .Transform), but
get this exception:

System.Text.EncoderFallbackException: Unable to translate Unicode character
\u2013 at index 3637 to specified code page.
What output encoding are you trying to transform to? It sounds as if the
result tree contains the Unicode character with hex code 2013 '–'
(decimal 8211) and that character is not contained in the code page you
want to use (e.g. with <xsl:output encoding="ISO-8859-1"or
XmlWriterSettings) so serializing the result tree with the desired
encoding fails.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Oct 13 '06 #2

"Martin Honnen" <ma*******@yahoo.deskrev i en meddelelse
news:OR**************@TK2MSFTNGP05.phx.gbl...
>

Peter Kirk wrote:

>I am trying to exexute a transform (XslCompiledTransform .Transform), but
get this exception:

System.Text.EncoderFallbackException: Unable to translate Unicode
character \u2013 at index 3637 to specified code page.

What output encoding are you trying to transform to? It sounds as if the
result tree contains the Unicode character with hex code 2013 '-' (decimal
8211) and that character is not contained in the code page you want to use
(e.g. with <xsl:output encoding="ISO-8859-1"or XmlWriterSettings) so
serializing the result tree with the desired encoding fails.
Well see, I know virtually nothing about these aspects. I have been supplied
with an xslt file which contains this line:

<xsl:output method="text" encoding="iso-8859-1"/>

I have written a method which accepts an xml string (which consists of data
extracted from a database), and tries to transform this xml to csv format
using an xslt file (supplied by someone else). Could the problem be in the
"encoding" specified in the xslt? Or is it the xml data? What can I do to
avert the exception?

The transformation works with some data, but fails with other data. So it
appears there are some characters in some data which the transformation/xslt
cannot handle, but I don't really know where a fix for this should reside.

Thanks,
Peter
Oct 13 '06 #3


Peter Kirk wrote:

Well see, I know virtually nothing about these aspects. I have been supplied
with an xslt file which contains this line:

<xsl:output method="text" encoding="iso-8859-1"/>

I have written a method which accepts an xml string (which consists of data
extracted from a database), and tries to transform this xml to csv format
using an xslt file (supplied by someone else). Could the problem be in the
"encoding" specified in the xslt? Or is it the xml data? What can I do to
avert the exception?
The problem is that the XSLT stylesheet tries to output the character
'' but that character is not contained in ISO-8859-1. Whether that
character is copied from the input or contained literally in the
stylesheet does not matter.

Use
<xsl:output method="text" encoding="UTF-8"/>
then you should not have any problems as UTF-8 as an Unciode encoding
can handle all Unicode characters.
Alternatively if you want text in a 8bit Windows code page then doing e.g.
<xsl:output method="text" encoding="Windows-1252"/>
should do, at least for that particular character you have shown:
<http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx>
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Oct 13 '06 #4

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

Similar topics

3
by: Eckhard Schwabe | last post by:
when switching from the old "XslTransform " to "XslCompiledTransform" I notice a difference in the handling of whitespace. I need to transform a XML file which contain tabs (\t), and which remain...
1
by: Steve | last post by:
Using VB.NET 2.0 I have a simple routine that attempts transforms an XmlDocument with an XSLT stylesheet into HTML. Under the old 1.1 framework with XslTransform, everything worked fine. Now...
6
by: W. Jordan | last post by:
Hello there, Are there anybody who is using the XslCompiledTransform that comes with .net framework, which was said to be a replacement of the XslTransform class? I found that the class has...
4
by: andrewcw | last post by:
I am moving some code forward from .NET 1.1. I was able to load the XSL file and perform the transform. The MSDN documentation looks like it should be easy. But I get a compile error. Ideas ?...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
1
by: mikepmyers | last post by:
I've done some research online and turned up with results that did not sit well with me. Im using the System.Xml.XslCompiledTransform class as recommended by MS; however, its creating self-closing...
1
by: Hans Kesting | last post by:
Hi, In our ASP.Net webapplications, we use xslt a lot. For 1.1 developing was "easy": start up the website and go to the page where the xslt was used. Change the xslt (save it) and refresh the...
1
by: Mark | last post by:
I'm getting the error "The URI scheme is too long." in the code below. What is URI in this context? The XSL or the XML being transformed? Thanks! -Mark StringBuilder sb = new...
3
by: Andy Fish | last post by:
Hi, From reading the documentation, I get the impression that XslCompiledTransform should be faster than XslTransform on my test with a large complex document and a large complex XSLT, the...
1
by: =?Utf-8?B?d2VqaXY=?= | last post by:
When I use xslCompiledTransform() or xslCompiledTransform(false) I find that the XPath queries in my select query attributes do not recognize any attributes inthe xml document. But when I enable...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.