473,246 Members | 1,533 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,246 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 4139
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: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.