c# - Proper contents of first three lines of xml doc using xsl stylesheet -


i inherited report generator creates xml file , formats using xsl/css. i'm not familiar web page creation. .html file created line of code:

xslt.transform(xmlreader.create(xmlstream), writer); 

and displayed in .net 4.5.2 system.windows.controls.webbrowser object. report looks fine. renders nicely in ie 11, , not in firefox (some background colors missing).

more importantly, though, user reporting problems converting .html .pdf using adobe acrobat (some images sized incorrectly) i'm investigating quality of .html formatting. opened .xml file created report generator in visual studio 2013 , flagged first 2 lines problems:

<?xml:stylesheet type="text/xsl" href="mydir\report.xsl" ?> <?xml version="1.0"?> <myclass xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> 

the first line flagged error: "invalid characters in processing instruction target" second line flagged error: unexpected xml declaration. xml declaration must first node in document no white space characters allowed appear before it."

how structure lines make visual studio happy (without degrading end result, of course).

in case useful, here first line of report.xsl:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> 

visual studio seems happy file.

thank you.

the xml declaration needs come first , processing instruction should xml-stylesheet:

<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="mydir/report.xsl" ?> <myclass xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -