473,387 Members | 1,892 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,387 software developers and data experts.

differences between XslTransform and XslCompiledTransform

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 untouched when I
use XslTransform to do the transformation.
But after switching to XslCompiledTransform the tabs are transformed to
a single space in the result file, which leads to problems later on the
the program.

what I found was:
http://blogs.msdn.com/xmlteam/articl...Transform.aspx

which states:

"To load the cache, XslCompiledTransform uses XmlReader to read the
input document. At this time, XslCompiledTransform applies whitespace
stripping rules."

So What I tried:

- added a <xsl:preserve-space elements="_element_name"/> to the
stylesheet. I tried various Element names, but this didn't seem to make
any difference (or I made a mistake?)

- tried using a XmlReader with "IgnoreWhitespace":

XmlReaderSettings rs = new XmlReaderSettings();
rs.IgnoreWhitespace = false;
reader = XmlReader.Create(filePath, rs);
m_XslTransform.Transform(reader, new System.Xml.Xsl.XsltArgumentList(), ms);

Both of which resultet in the same: all tabs are gone.

Is there something I can do, or do I have to stay with XslTransform?

Thanks,

Ecki
Dec 2 '05 #1
3 4158
I found the solution for myself.

By default the XslCompiledTransform uses a XmlReader, which allways does
Normalizaion. But you can force the "old" behaviour by just giving it
a XmlTextReader instance to the transform method.
XmlTextReader does per default no normalization.

Remark: Seems like we never should have used tabs in Attribute Values to
start with.

Eckhard Schwabe wrote:
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 untouched when I
use XslTransform to do the transformation.
But after switching to XslCompiledTransform the tabs are transformed to
a single space in the result file, which leads to problems later on the
the program.

Dec 3 '05 #2
You might also want to check out this blog post:
http://blogs.msdn.com/xmlteam/articl...Transform.aspx

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

"Eckhard Schwabe" <es******@web.de> wrote in message
news:%2*****************@TK2MSFTNGP15.phx.gbl...
I found the solution for myself.

By default the XslCompiledTransform uses a XmlReader, which allways does
Normalizaion. But you can force the "old" behaviour by just giving it a
XmlTextReader instance to the transform method.
XmlTextReader does per default no normalization.

Remark: Seems like we never should have used tabs in Attribute Values to
start with.

Eckhard Schwabe wrote:
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 untouched when I use
XslTransform to do the transformation.
But after switching to XslCompiledTransform the tabs are transformed to a
single space in the result file, which leads to problems later on the the
program.

Dec 5 '05 #3
Hello Stan,

Stan Kitsis [MSFT] wrote:
You might also want to check out this blog post:
http://blogs.msdn.com/xmlteam/articl...Transform.aspx


I think I read this article before, but it should be updated to clearly
state that the normalization behaviour is changed since XslTransform.

Regards,

Eckhard

Dec 11 '05 #4

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

Similar topics

1
by: cody | last post by:
Iam using Beta2 of VS2005 and got this strange message: Warning 1 'System.Xml.Xsl.XslTransform' is obsolete: 'This class has been deprecated. Please use System.Xml.Xsl.XslCompiledTransform...
0
by: Matt | last post by:
With VS2005 I see that the XslTransform class has been deprecated and XslCompiledTransform has replaced it. I am having issues with trying to get the new class to work how it did with the old. I...
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: Praveen | last post by:
Have a common function in Javascript which do transform for all .xsl's. XSL object is loaded like this. var xslobj=new ActiveXObject("MSXML2.FreeThreadedDOMDocument.4.0"); xslobj.async = false;...
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...
2
by: steve.nickels | last post by:
Hello. I'm in the midst of moving a web application from ASP.NET 1.1 to ASP.NET 2.0 (framework 3.0), and as part of this move, I am told by Visual Studio that the XslTransform object is now...
9
by: WT | last post by:
Hello, I have code created with .net 1.0 and migrated to 3.5. Form 2.0 the XslTransform class is obsolete and the vs2008 compiler generates warnings that these classes are absolete suggesting to...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
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,...
0
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...

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.