473,789 Members | 2,478 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 1725
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
2749
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 http://www.discovertravelandtours.com/test/templates/test2.xml?Location=Germany
1
1828
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 an output root element
1
5581
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 "yes", the HTML formatting tags are displayed correctly, but the French accented characters are...
4
1983
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 htmlencoded, it means that my method (wich work as intended in other contexts) is called but the...
7
2871
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); xmlItems.TransformArgumentList = xsltArgList;
12
2921
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(); xslt.Transform(nav, null, strWriter, null);
18
2088
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 and A2 and feature B depends on B1 and B2. And write that to a text file.
3
9615
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 describe the problem I have provided some example data below along with my a portion of my current...
3
4530
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" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result- prefixes="msxsl">
0
9511
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10136
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6765
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.