[xsl] Cannot have a DOCTYPE declaration outside of a prolog

Subject: [xsl] Cannot have a DOCTYPE declaration outside of a prolog
From: mad rat <mad_rat_on_run@xxxxxxxxx>
Date: Wed, 27 Apr 2005 20:39:18 -0700 (PDT)
=======================================================
The XML page cannot be displayed 
Cannot view XML input using XSL style sheet. Please
correct the error and then click the Refresh button,
or try again later. 


--------------------------------------------------------------------------------

Cannot have a DOCTYPE declaration outside of a prolog.
Error processing resource
'http://localhost:28178/omniparkv3/search....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
----------^
=======================================================


I am getting the above error while trying to return
XML data via Response.Write as follows : 

=======================================================
                HttpContext current;
                current = HttpContext.Current;
                current.Response.ContentType =
"text/xml";                
                current.Response.ContentEncoding = new
System.Text.UTF8Encoding();
                current.Response.ClearContent();

                StringBuilder xml = new
StringBuilder();
                xml.Append("<?xml version=" + "\"" +
"1.0" + "\"" + "?>\r\n");
                xml.Append("<?xml-stylesheet
type=\"text/xsl\"
href=\"http://localhost/transform.xsl\";?>");
                xml.Append("");
                xml.Append("<!-- Title -->\r\n");
                xml.Append("<T1>\r\n");
                xml.Append("<Message>Some
text</Message>\r\n");
                xml.Append("</T1>\r");
               
current.Response.Write(xml.ToString());
=======================================================

Someone answered in a similar discussion in the
archives that following worked : 

<xsl:output doctype-public="-//W3C//DTD HTML 4.01//EN"
doctype-system="http://www.w3.org/TR/html4/strict.dtd";
method="html" version="4.01" encoding="UTF-8"
indent="yes"/>

I placed following file at
http://localhost/transform.xsl in the xml data I
returned as written above : 

=======================================================
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<xsl:output doctype-public="-//W3C//DTD HTML 4.01//EN"
doctype-system="http://www.w3.org/TR/html4/strict.dtd";
method="html" version="4.01" encoding="UTF-8"
indent="yes"/>

</xsl:stylesheet>
=======================================================

Even after this I am still getting the same error
although IE does appear to apply this xsl file since
it  says 'this page is accessing information that is
not under its control .....'

Any help would be appreciated.

Thanks.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread