473,503 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XslCompiledTransform behaves differently than XslTransform

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 deprecated, and I
should use XslCompiledTransform. For the most part changing to this
object works fine, however I have noticed in some cases a difference
of behavior that breaks the proper running of my app.

I am using XSL templates to transform XML into HTML to be outputted to
the browser, and in some of my templates I have HTML "script" tags,
like so:

<script ...></script>

Using the old XslTransform object, this was handled just fine.
However, using the new XslCompiledTransform object, instances of these
script tags are reduced to single-tag versions in the output, like so:

<script ... />

Since this syntax is currently not valid HTML, browsers are not
correctly handling this output, and I get lots of javascript errors
and display problems.

Is this expected behavior by the new XslCompiledTransform object? Is
there any way to prevent it from doing this, or do I just need to keep
using the deprecated XslTransform instead?

Thanks!

--Steve
Mar 4 '08 #1
2 3427
st***********@gmail.com wrote:
I am using XSL templates to transform XML into HTML to be outputted to
the browser, and in some of my templates I have HTML "script" tags,
like so:

<script ...></script>

Using the old XslTransform object, this was handled just fine.
However, using the new XslCompiledTransform object, instances of these
script tags are reduced to single-tag versions in the output, like so:

<script ... />
Make sure your stylesheet has
<xsl:output method="html"/>
and that script element is in no namespace.

If you still have problems then show us how you use XslCompiledTransform
exactly, you might need to make sure you use the OutputSettings property
of XslCompiledTransform:
<URL:http://msdn2.microsoft.com/en-us/library/System.Xml.Xsl.XslCompiledTransform.OutputSettings .aspx>
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Mar 4 '08 #2
On Mar 4, 11:38 am, Martin Honnen <mahotr...@yahoo.dewrote:
steve.nick...@gmail.com wrote:
I am using XSL templates to transform XML into HTML to be outputted to
the browser, and in some of my templates I have HTML "script" tags,
like so:
<script ...></script>
Using the old XslTransform object, this was handled just fine.
However, using the new XslCompiledTransform object, instances of these
script tags are reduced to single-tag versions in the output, like so:
<script ... />

Make sure your stylesheet has
<xsl:output method="html"/>
and that script element is in no namespace.
Adding the xsl:output tag fixed the problem.

Thanks!

--Steve
Mar 5 '08 #3

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

Similar topics

3
4172
by: Eckhard Schwabe | last post by:
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...
0
1196
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...
1
2576
by: Steve | last post by:
Using VB.NET 2.0 I have a simple routine that attempts transforms an XmlDocument with an XSLT stylesheet into HTML. Under the old 1.1 framework with XslTransform, everything worked fine. Now...
6
8077
by: W. Jordan | last post by:
Hello there, Are there anybody who is using the XslCompiledTransform that comes with .net framework, which was said to be a replacement of the XslTransform class? I found that the class has...
1
496
by: Sunday Oke | last post by:
Hi folks I have this code which basically transforms a recordset retrieved from a oracle database. With the XslTransform class being deprecated I have tried to use the XslCompiledTransform class...
12
10059
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)...
3
5430
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...
1
1628
by: =?Utf-8?B?Vmlub2Q=?= | last post by:
Hi, I am having a problem doing the transform. Actually i am migrating the code from XslTranform class into XslCompiledTransform class. Here is the code that i am using in .net 1.1 private...
0
1230
by: bryhi | last post by:
Here is the code you can past in your console application to see the differences. I need to know how to get this to work correctly. #pragma warning disable // because we are using a depricated...
0
7205
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
7093
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
7287
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,...
1
7008
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...
0
5594
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,...
1
5022
isladogs
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...
0
3177
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...
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
399
bsmnconsultancy
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...

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.