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

Xml WebControl's Transform property in ASP.NET 2.0

We're in the process of migrating our projects to use VS2005 from
VS2003. We have a web page that uses the XML WebControl
(System.Web.UI.WebControls.Xml) to perform an XSLT tranformation by
using the property "Transform" of the webcontrol. Here is a sample:

xmlMessage.Transform = _app.Cache.UserMessagesXsltUser;

'xmlMessage' is the XML Web Control, and
'_app.Cache.UserMessagesXsltUser' is the transformation to apply.

In .NET 1.1, the class of the transformation was XslTransform.
In .NET 2.0 this class has been deprecated by the new
XslCompiledTransform class. However, the Xml Web control's
'Transform' property still takes an object of type 'XslTransform',
instead of the new class of 'XslCompiledTransform'.

How do I migrate the Xml web control's Transform property in .NET 2.0?
Is there a new version of the Xml Web Control with a Transform property
that takes an object of type XslCompiledTransform?

Thanks!
--steve

Nov 19 '05 #1
7 3396
Any ideas?

--steve

Nov 19 '05 #2
I have lots of them, but not enough time to implement many of them.

I also have an idea that this refers to something you posted earlier,
perhaps in this thread. But my newsreader hides read messages, and it's too
much trouble for me to go looking for it.

;-)

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

<n3****@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Any ideas?

--steve

Nov 19 '05 #3
Kevin,

I'm lost, what are you getting at? I cross-posted the same question on
microsoft.public.dotnet.framework.aspnet.webcontro ls, is that what
you're talking about? At any rate, the question is still unanswered.

I'm surprised that if the XslTransform class is being deprecated in
..NET 2.0 by the XslCompiledTransform class, that the XML webcontrol's
'Transform' property (System.Web.UI.WebControls.Xml) does not at least
provide an overload to call it with new class.

I'm not asking you to provide with sample code, or implement any sort
of solution, just give me a pointer in the right direction.

In the meantime, I'm trying to refactor our code to get rid of the use
of the Xml webcontrol, and perform the transformation manually.

--steve

Nov 19 '05 #4
Hi steve,
I'm surprised that if the XslTransform class is being deprecated in
.NET 2.0 by the XslCompiledTransform class, that the XML webcontrol's
'Transform' property (System.Web.UI.WebControls.Xml) does not at least
provide an overload to call it with new class.
As to why it is being deprecated, read the following article from the msdn2
online library:

http://msdn2.microsoft.com/en-us/library/66f54faw.aspx

Why the "Transform" property is not overloaded, I can't say. I don't know
all the inner workings of the XML WebControl. It does seem like a good idea.
At any rate, the following msdn2 article indicates that you can use an
XslCompiledTransform class to format the XML, and how to do it:

http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

"n33470" <n3****@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com... Kevin,

I'm lost, what are you getting at? I cross-posted the same question on
microsoft.public.dotnet.framework.aspnet.webcontro ls, is that what
you're talking about? At any rate, the question is still unanswered.

I'm surprised that if the XslTransform class is being deprecated in
.NET 2.0 by the XslCompiledTransform class, that the XML webcontrol's
'Transform' property (System.Web.UI.WebControls.Xml) does not at least
provide an overload to call it with new class.

I'm not asking you to provide with sample code, or implement any sort
of solution, just give me a pointer in the right direction.

In the meantime, I'm trying to refactor our code to get rid of the use
of the Xml webcontrol, and perform the transformation manually.

--steve

Nov 19 '05 #5
Im having the same problem and I think this may be a bug. If you look at the
documentation for the Xml control it says:

"You can format the XML document with a System.Xml.Xsl.XslCompiledTransform
object or with an XSL Transformation style sheet file by setting the
appropriate property."
Not that it says XslCompiledTransform, but the Transform property is if Type
XslTransform.

Basically anybody that uses this control is screwed because you will get
errors telling you to use the XslCompiledTransform but the Transform property
only takes an XlsTransform.

What is the workaround?

"Kevin Spencer" wrote:
Hi steve,
I'm surprised that if the XslTransform class is being deprecated in
.NET 2.0 by the XslCompiledTransform class, that the XML webcontrol's
'Transform' property (System.Web.UI.WebControls.Xml) does not at least
provide an overload to call it with new class.


As to why it is being deprecated, read the following article from the msdn2
online library:

http://msdn2.microsoft.com/en-us/library/66f54faw.aspx

Why the "Transform" property is not overloaded, I can't say. I don't know
all the inner workings of the XML WebControl. It does seem like a good idea.
At any rate, the following msdn2 article indicates that you can use an
XslCompiledTransform class to format the XML, and how to do it:

http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

"n33470" <n3****@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Kevin,

I'm lost, what are you getting at? I cross-posted the same question on
microsoft.public.dotnet.framework.aspnet.webcontro ls, is that what
you're talking about? At any rate, the question is still unanswered.

I'm surprised that if the XslTransform class is being deprecated in
.NET 2.0 by the XslCompiledTransform class, that the XML webcontrol's
'Transform' property (System.Web.UI.WebControls.Xml) does not at least
provide an overload to call it with new class.

I'm not asking you to provide with sample code, or implement any sort
of solution, just give me a pointer in the right direction.

In the meantime, I'm trying to refactor our code to get rid of the use
of the Xml webcontrol, and perform the transformation manually.

--steve


Dec 15 '05 #6
The workaround for me was to get rid of the Xml web control completely.
Since we're just using it to transform an xml doc to html and then
dump the contents on a web page, I replaced the Xml web control with a
simple Literal control. Then, I just programmatically transform the
xml doc and put the result of the transformation (which for us is raw
html) into the literal.

Something like this (where doc is XmlDocument, litUserMessages is the
literal):

System.Text.StringBuilder sb = new System.Text.StringBuilder();
XmlTextWriter writer = new XmlTextWriter(new
System.IO.StringWriter(sb));
myTransform.Transform(doc, null, writer);
litUserMessages.Text = sb.ToString();

--steve

Dec 15 '05 #7
The workaround for me was to get rid of the Xml web control completely.
Since we're just using it to transform an xml doc to html and then
dump the contents on a web page, I replaced the Xml web control with a
simple Literal control. Then, I just programmatically transform the
xml doc and put the result of the transformation (which for us is raw
html) into the literal.

Something like this (where doc is XmlDocument, litUserMessages is the
literal):

System.Text.StringBuilder sb = new System.Text.StringBuilder();
XmlTextWriter writer = new XmlTextWriter(new
System.IO.StringWriter(sb));
myTransform.Transform(doc, null, writer);
litUserMessages.Text = sb.ToString();

--steve

Dec 15 '05 #8

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

Similar topics

1
by: Quentin | last post by:
hey there, ok i made a class, that inherits webcontrol, and i add an htmltable to it. I was wondering how to declare an ascx file as an object in my class, like that i could change the content...
0
by: Matze | last post by:
I have a function that has an Argument of type System.Web.UI.WebControls.WebControl. I want to set the text-property of that control. Of course it doesnt work if I cast that control to...
0
by: George Kustas | last post by:
I am using the Xml Web control to transform an XML string insto a readable HTML display on the page: Xml1.DocumentContent = <XML string from my database> Xml1.TransformSource =...
0
by: Harry F. Harrison | last post by:
Here's the situation...Context - Using an Inherited WebControl object as a base for server custom controls. In a web custom control, whenever I create a child control and add it to the Controls...
0
by: Lucas, Todd | last post by:
Hello everyone! I'm having a problem with a WebControl that I'm designing for a Menu. I've been at it for about 3 weeks now, and can't seem to get around this problem. So I'm hoping that someone...
9
by: kw | last post by:
What is the proper way to get the element ID for a client script? For example, suppose in the WebControl: TextBox t=new TextBox; t.ID=this.ClientID+"X"; .... Then elsewhere we want to access...
0
by: Alex Nitulescu | last post by:
Hi, I have the following in project "RaducuCustomControls": Imports System.ComponentModel Imports System.Web.UI <DefaultProperty("Text"), ToolboxData("<{0}:Rotator1...
0
by: Mike Hofer | last post by:
Hi everyone. I could really use some help. First, the backstory: ===================== I *really* need a 3-state checkbox for my ASP.NET application. Specifically, I need one that lets me set...
0
by: Charlie | last post by:
When a property of a WebControl is changed at design-time in the property window, the Render method for that WebControls runs. When the property of one WebControl cascades to another WebControl,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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...
0
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,...
0
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...

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.