473,573 Members | 3,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1704

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?

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

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

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 straight XML file http://www.discovertravelandtours.com/test/templates/test.xml?Location=Germany To another XML file ...
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 space attribute in the root of the output, or generating other attributes in the root? The following illustrates the case. The XSLT script specifies...
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. I have specified <xsl:output method="html"/> and encoding="iso-8859-1". When I apply the xsl:value-of and set the disable-output-escaping to...
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 output the formatted string. So far everything process correctly (the method is called without any issue) but my problem is that the output is...
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 parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID);...
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 the file. Here is the code snippet: XPathDocument xdoc = new XPathDocument(fs); XPathNavigator nav = xdoc.CreateNavigator();...
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 look up what each feature depends on and gerenate a text file. For example, in the following file, I would like to find out feature A depends on A1...
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 difference between two source documents and output node-sets which are "different" (changed or new) to new XML files using xsl:result-document To...
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 missed: My template is: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform"...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.