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

XSLT created UserControl gives 'not well formed' error

I've got a usercontrol created on the fly using XSLT:

<%@ Control Language='vb' AutoEventWireup='false'
Codebehind='DynamicContent.ascx.vb'
Inherits='System.Web.UI.UserControl'
TargetSchema='http://schemas.microsoft.com/intellisense/ie
5' %>
<asp:Panel id="Panel_welcome" runat="server"
xmlns:asp="remove">
<asp:Image id="Image_welcome"
ImageUrl="PeopleOnBeach.jpg" runat="server"
class="picture_left">
</asp:Image>
</asp:Panel>

The <asp:Panel element gives a "The server tag is not
well formed" error. If you remove the xmlns:asp
attribute, it's OK. If you remove the runat="server"
attribute, the usercontrol loads OK (and the asp:Image
appears as an <IMG> correctly), but the <asp:Panel just
get's pushed straight through to the client, where the
browser ie6 ignores it.

Q1) Are <asp:Panel/> tags in the HTML output likely to
break some browsers?
Q2) Why does VS complain that 'The server tag is not well
formed?'

The whole surrounding problem is of trying to get data
held in XML to get translated to dynamically created web
server controls, but WITHOUT having to Parse and Add each
control in a code loop. (I'm just being bloody minded!)

Thanks!
Andy
Nov 18 '05 #1
4 2514
> Q1) Are <asp:Panel/> tags in the HTML output likely to
break some browsers?


If everything is correct, NO browser will see the <asp:Panel/> tag, and
should ignore
it if it was present. The ASP.Net system should translate this into
something the
current browser can understand.
By the way: interesting thing you are trying to do. Where exactly do you
generate
this code? Is it really translated by the ASP.Net system?
Hans Kesting
Nov 18 '05 #2
Thanks for your reply Hans,

my (secondary) problem is that The
<asp:Panel>...</asp:Panel> DOES make it though to the
HTML that appears on the client browser. (as the
runat='server' is missing, I assume the ASP.NET server
doesn't bother trying to translate it into a legal HTML
tag). But at least it doesn't throw up the 'not well
formed' error when the usercontrol is loaded
(programatically in the Page_Load event) - this is my
primary problem!

see:

http://www.gotdotnet.com/Community/M...ard/Thread.asp
x?id=165569&Page=1#166836

for more information on my trials so far!

The difficulty is getting ASP.NET to render the
<asp:control> tags before it sends the output off to the
client. You can use XSLT to transform the XML data into a
list of <asp:controls>, and then I think a previous
method was to add each control to the list in a loop (in
Page_Load e.g.) with Page.ParseControl (which turns the
<asp:control.... markup into a Control object which you
can add to the Page's Controls collection.

I wanted to do it with less code! (because I'm lazy, and
also for better encapsulation!) There's additional
problems of connecting dynamically added controls to the
code-behind if you want to play with the control's....
but I'm not at that point yet.

Downside with my method is that you've got to go via a
ascx file, so there's a read/write speed penalty. Might
be able to get Caching and auto event wireup going
though... Dunno!

What do you think?
-----Original Message-----
Q1) Are <asp:Panel/> tags in the HTML output likely to
break some browsers?
If everything is correct, NO browser will see the

<asp:Panel/> tag, andshould ignore
it if it was present. The ASP.Net system should translate this intosomething the
current browser can understand.
By the way: interesting thing you are trying to do. Where exactly do yougenerate
this code? Is it really translated by the ASP.Net system?
Hans Kesting
.

Nov 18 '05 #3
Andy-
Could it be that you are giving the asp namespace a bogus definition;
i.e., "remove"? I have no idea what the proper string is, but I'm guessing
that your namespace definition makes the asp:Panel unrecognizable while the
runat = "server" implies that it *should* be something recognizable.

BTW, are you actually intending to send asp:Panel elements to a browser
(and if so, why?) I'm a bit of a newbie myself so this is just a guess.

Regards,
Bill

"wtsnet" <an*******@discussions.microsoft.com> wrote in message
news:0b****************************@phx.gbl...
I've got a usercontrol created on the fly using XSLT:

<%@ Control Language='vb' AutoEventWireup='false'
Codebehind='DynamicContent.ascx.vb'
Inherits='System.Web.UI.UserControl'
TargetSchema='http://schemas.microsoft.com/intellisense/ie
5' %>
<asp:Panel id="Panel_welcome" runat="server"
xmlns:asp="remove">
<asp:Image id="Image_welcome"
ImageUrl="PeopleOnBeach.jpg" runat="server"
class="picture_left">
</asp:Image>
</asp:Panel>

The <asp:Panel element gives a "The server tag is not
well formed" error. If you remove the xmlns:asp
attribute, it's OK. If you remove the runat="server"
attribute, the usercontrol loads OK (and the asp:Image
appears as an <IMG> correctly), but the <asp:Panel just
get's pushed straight through to the client, where the
browser ie6 ignores it.

Q1) Are <asp:Panel/> tags in the HTML output likely to
break some browsers?
Q2) Why does VS complain that 'The server tag is not well
formed?'

The whole surrounding problem is of trying to get data
held in XML to get translated to dynamically created web
server controls, but WITHOUT having to Parse and Add each
control in a code loop. (I'm just being bloody minded!)

Thanks!
Andy

Nov 18 '05 #4
Hi Bill,

I agree with you that VS might need a proper valid
namespace definition - but what it would need I don't
know. Ideally I'd like to make the XSLT output elements
without any xmlns attributes, however I can't work out
how to do that. The closest I've got is to remove it from
children of a parent element (hence the Panel!). I don't
really *want* the panel...

Does that make any sense? Check out the link I posted to
the other thread for more background.

Thanks for your input though! My guesses are a) That
there's some sort of bug with usercontrols that doesn't
parse the <asp: elements properly ... my standard
paranoia reasoning! Or b) I'm not understanding how
namespaces work with usercontrols or XSLT transforms.
Which is why I've opened it up to the floor. Help!

I'm a bit new to ASP.NET (being a desktop coder), and am
never quite sure whether I'm doing things in a completely
stupid way!

Cheers,
Andy
-----Original Message-----
Andy-
Could it be that you are giving the asp namespace a bogus definition;i.e., "remove"? I have no idea what the proper string is, but I'm guessingthat your namespace definition makes the asp:Panel unrecognizable while therunat = "server" implies that it *should* be something recognizable.
BTW, are you actually intending to send asp:Panel elements to a browser(and if so, why?) I'm a bit of a newbie myself so this is just a guess.
Regards,
Bill


Nov 18 '05 #5

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

Similar topics

1
by: Justin Woodcock | last post by:
Hi, Is it possible to call an asp file that generates xslt using Objectname.load ? I have tried this script : <% Dim objXML, objXSL
13
by: Tjerk Wolterink | last post by:
Hello i've an xsl stylesheet that must support xhtml entities, my solution: ---- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE xsl:stylesheet > <xsl:stylesheet version="1.0"...
6
by: Prashanth Ellina | last post by:
Hi, I am an XSLT newbie. I need to solve something which I will express in pseudo-code. function f1() { xmltree = <emptydom> addnamevaluepair(xmltree, "size","100")...
9
by: Martin Plantec | last post by:
Hello, I have managed (with your help!) to make a working XSLT stylesheet; it works fine locally (Windows Apache + PHP with Sablotron 1.0), but it fails on the remote host (FreeBSD Apache + PHP...
2
by: chris | last post by:
Hi there, I create an XML file from a dataset like this: System.IO.StreamWriter xmlSW = new System.IO.StreamWriter(FILENAME); dsUserData1.WriteXml(xmlSW, XmlWriteMode.WriteSchema);...
6
by: Neal | last post by:
Hi All, I wrote a TOC treeview using xml and xslt, with help from this forum and MSDN help(thanks) Great in IE 6. (expect IE 5 as well, articles were circa 2000) However, Mozilla FireFox...
18
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...
8
by: Hercules Dev. | last post by:
Hi all, I'm new in xslt and xpath, so my question might be simple but i'm learning. I have an XML document and need to transform it into another XML, I use xslt and it works, but there is a...
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
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
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...

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.