473,698 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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='Dyn amicContent.asc x.vb'
Inherits='Syste m.Web.UI.UserCo ntrol'
TargetSchema='h ttp://schemas.microso ft.com/intellisense/ie
5' %>
<asp:Panel id="Panel_welco me" runat="server"
xmlns:asp="remo ve">
<asp:Image id="Image_welco me"
ImageUrl="Peopl eOnBeach.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 2520
> 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
(programaticall y in the Page_Load event) - this is my
primary problem!

see:

http://www.gotdotnet.com/Community/M...ard/Thread.asp
x?id=165569&Pag e=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.ParseContr ol (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*******@disc ussions.microso ft.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='Dyn amicContent.asc x.vb'
Inherits='Syste m.Web.UI.UserCo ntrol'
TargetSchema='h ttp://schemas.microso ft.com/intellisense/ie
5' %>
<asp:Panel id="Panel_welco me" runat="server"
xmlns:asp="remo ve">
<asp:Image id="Image_welco me"
ImageUrl="Peopl eOnBeach.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
3393
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
3670
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" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6
1514
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") addnamevaluepair(xmltree, "color","blue")
9
4791
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 with Sablotron 1.0) with the following: Warning: Sablotron error on line 1: XML parser error 4: not well-formed (invalid token) in /...host...path.../page.php on line 28 FAILURE : XML parser error 4: not well-formed (invalid token) ; error
2
5283
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); xmlSW.Close(); Which gives me this XML file: <NewDataSet>
6
1565
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 (latest), gives me the following error. " Error Loading Stylesheet: Parsing an XSLT stylesheet failed " And the Mozilla forums have no answer, so... hopefully here !
18
2076
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 look up what each feature depends on and gerenate a text file. For example, in the following file, I would like to find out feature A depends on A1 and A2 and feature B depends on B1 and B2. And write that to a text file.
8
15895
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 case that i don't know how to solve, I need to concat a string from multiple childs into a standard way, the following is an example of the source and the target XML.
0
8676
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9029
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7732
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6522
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
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 we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.