[xsl] outputting <?xml version="1.0" encoding="UTF-8" ?>

Subject: [xsl] outputting <?xml version="1.0" encoding="UTF-8" ?>
From: "Ian Murphy" <ian@xxxxxxxxxxxxxx>
Date: Fri, 15 Sep 2006 14:23:25 +0200
I'm generating an Excel xml file as output and I've got the following as
the beginning of my xsl sheet:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet
	xmlns:x="urn:schemas-microsoft-com:office:excel"
	xmlns:o="urn:schemas-microsoft-com:office:office"
	xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

<xsl:output method="xml" version="1.0" encoding="UTF-8"
omit-xml-declaration="no"/>

<xsl:template match="/">
	<xsl:processing-instruction name="mso-application">
		<xsl:text>progid="Excel.Sheet"</xsl:text>
	</xsl:processing-instruction>

My problem is that the <?xml version="1.0" encoding="UTF-8" ?> which
should appear at the top as a header, doesn't. Anyone got any
suggestions as to why this would be? I've checked though dpdawsons site
and spent several hours trawling google without getting anywhere.

I'm using vb.net 1.1 to do the transforms and feed files them out via
iis. I generate the file using the following (abreviated) code:

	oXmlTxtWrt = New XmlTextWriter(oFsXML,
System.Text.Encoding.Unicode)
	oXslTran = New Xml.Xsl.XslTransform
	oXslTran.Load(strXSLFile)
	oXPathNavigator = oXPath.CreateNavigator
      oXslTran.Transform(oXPathNavigator, Nothing, oXmlTxtWrt, Nothing)

My file is correctly formatted, except for the missing xml header. It
must be something obvious but I just can't see it.

Thanks

Ian Murphy
Integra XP
http://www.integra-xp.com
00 34 94 621 5265

Current Thread