Connecting Tech Pros Worldwide Help | Site Map

XML declaration in middle of page?

Newbie
 
Join Date: Dec 2008
Posts: 10
#1: Dec 29 '08
I'm not sure if this would classify as an XML or ASP question:

I'm redoing someone's website who sells various products. I've decided to teach myself XSLT and re-do the entire site using XML.

I'm creating .aspx files with which will include an XML file of the products at the bottom of each page. To do this, I have the following code in my .aspx file where the XML data goes:

<asp:Xml runat="server" documentSource="more.xml" transformSource="awboi.xsl" id="Xml1" />

The XML file displays perfectly and is transformed exactly as it should be. However, when I go to validate the page at the W3C website, it will not validate because an XML declaration has been added at the point the code (above) is in my source.

So, in the middle of my source code is:

<?xml version="1.0" encoding="utf-8"?>
...and then all my transformed XML data


Is this a big deal not to pass validation on one error? Is there a way to prevent ASP from adding the XML declaration in the middle of my page? I'm using Expression Web if that makes any difference.

Thanks for any thoughts. I appreciate it. This is only my 3rd day of learning XML and XSLT, so go easy on me.

Here are the links to the various pages:

Page in question: Sample Page - View Source to see what I mean
XML source: XML File
XSL source: XSL File
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#2: Dec 30 '08

re: XML declaration in middle of page?


Please post the code you have that applies the XSL to the XML.
You may have to remove the "<?xml version="1.0" encoding="utf-8"?>"' after the XML has been transformed (something like this).

-Frinny
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#3: Dec 30 '08

re: XML declaration in middle of page?


you could try the following:
Expand|Select|Wrap|Line Numbers
  1. <xsl:output 
  2.     method="xml"
  3.     omit-xml-declaration="yes" />
Newbie
 
Join Date: Dec 2008
Posts: 10
#4: Dec 30 '08

re: XML declaration in middle of page?


Thanks Dormilich! You're awesome! That worked perfectly.
Reply