473,320 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

XSLT output and restricted encoding in Widbey

In .Net 1.1, System.Xml.Xsl.XslTransform cannot output directly a document
in an encoding that cannot represent all the characters used (e.g. write in
us-ascii for compatibility, and convert all non-ascii chars to entities).
While it can be worked around (by defining a TextWriter that does the
conversion to entities), it's not very elegant (because the information on
encodings must be duplicated outside the XSLT file) and breaks compatibility
with msxml (which can handle this).
Can you tell me whether .Net 2.0 fixes this?
Thanks in advance!
--
Lionel Fourquaux

Nov 12 '05 #1
2 1677
Lionel,

I am not sure your question has anything to do with XSLT per se, but XML
generally. When you specify an encoding on an XML document, you are saying
that the document contents conform to that encoding.

I think this is covered in the XML specification [1]:

"It is a fatal error if an XML entity is determined (via default, encoding
declaration, or higher-level protocol) to be in a certain encoding but
contains byte sequences that are not legal in that encoding."

It is a separate question whether the characters are represented as literal
text or using character encodings. It would be an error for any XML document
(regardless of how it is produced) to say that it is encoded in us-ascii and
then include non-us-ascii characters as text or as encoded characters.

If you want compatibility in XML, as you indicate, you should use one of the
two encodings that all XML parsers are required to support [2], UTF-8 or
UTF-16. Or perhaps you meant compatibility with some other software?

Cheers,
Stuart Celarier, Fern Creek

[1] http://www.w3.org/TR/2004/REC-xml-20.../#charencoding
[2] http://www.w3.org/TR/2004/REC-xml-20040204/#charsets
Nov 12 '05 #2
"Stuart Celarier" <stuart at ferncrk dot com> a écrit dans le message de
news: OH**************@TK2MSFTNGP14.phx.gbl...
I am not sure your question has anything to do with XSLT per se, but XML
generally. When you specify an encoding on an XML document, you are saying
that the document contents conform to that encoding.
The document must be described using this encoding, but it can reference any
unicode character using character references.

What I'm referring to is this part of the XSLT spec:
"It is possible that the result tree will contain a character that cannot be
represented in the encoding that the XSLT processor is using for output. In
this case, if the character occurs in a context where XML recognizes
character references (i.e. in the value of an attribute node or text node),
then the character should be output as a character reference; otherwise (for
example if the character occurs in the name of an element) the XSLT
processor should signal an error."
(http://www.w3.org/TR/xslt.html#secti...-Output-Method)

Oleg Tkachenko describes the problem (XslTransform doesn't do this) and
gives a workaround in his blog
(http://www.tkachenko.com/blog/archives/000266.html). I'd like to know
whether I can hope for a more elegant solution in .Net 2.0. (I assume some
people here are beta-testing it).
Or perhaps you meant compatibility with some other software?


That's it.

Nov 12 '05 #3

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

Similar topics

6
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I have an XSLT file which should be transforming a...
1
by: Wolfgang | last post by:
XSLT transformations by default seem to pass name space attributes into the root element of their output (example below). QUESTION: Is it possible to control this, i.e. not genrating a name...
1
by: Lisa | last post by:
I need to apply the HTML formatting tags and the French accented characters in a XML document. The XML is generated from a database that has HTML tags and French accented characters in the records....
4
by: Gauthier | last post by:
Hi, I've a simple issue with the use of extension objects. I'm trying to call a text formating method from an object that I add to my arguments collection, this method take an input string and...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
12
by: das | last post by:
Hello all, I am using .NET XSLT to transform an XML into another XML file. All this is fine with small files, but when tested with big files (30MB) it is taking between 1hr-2hrs to just transform...
18
by: yinglcs | last post by:
Hi, I have a newbie XSLT question. I have the following xml, and I would like to find out the children of feature element in each 'features' element. i.e. for each <featuresI would like to...
3
by: super.raddish | last post by:
Greetings, I am relatively new to, what I would call, advanced XSLT/XPath and I am after some advice from those in the know. I am attempting to figure out a mechanism within XSLT to compare the...
3
by: joelkeepup | last post by:
Hi, im trying to create a text email message using xslt template , the transforms work great, but the newlines and whitespace in the xslt doc are removed. Is there a setting somewhere I have...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.