if you are writing a CSV file the method should probably not be "xml" as Sean B. Durkin suggests.
i recommend this configuration to make a CSV that will correctly open in Excel
<xsl:output method="text" byte-order-mark="yes" encoding="UTF-16LE" indent="no"/>
Other tips when using XSLT to generate a CSV:
You can use TAB characters even though CSV means "comma separated value"
I find the data i separate is often void of tabs but has the occasional comma.
and <xsl:text>
</xsl:text>
is a way to add a line-break.
you probably want to escape linebreaks that occur in the values you use, like this:
<xsl:value-of select="replace($foo,'\n','\\n')"/>
and of course, you will quickly notice that if you open the file in Excel, it becomes read-only which is a bother when you try to generate the file again while it is still open. unlike most text editors which simply tell you the file has changed, and offer to reload it.
-
I realize this question is dated and answered already, but I hope this helps a future someone.