White space precceding converted file

Here should go questions about transforming XML with XSLT and FOP.
RhysC
Posts: 2

White space precceding converted file

Thu Mar 17, 2005 4:53 am

I am converting an XML document to HTML and require this html document to be EDI'ed on.
Unfortunately during the xslt parse there is three white space characters being added to th start of the file preventing the EDI function. These chars are obviously not visble in note pad or IE when viewing the html, however in the only viewable in a Binary editor in visual studio there characters values (in hex) are "EF BB BF" which appear as "  " when pasted in here
Why are these getting added onto the start of the file? it seems to happen even in a text conversion.
Is it the VB.net 2.0 Code:

Dim nameXslt As New Query.XsltCommand
'Compile the stylesheet.
nameXslt.Compile(XSLTFile)
'Transform the file.
nameXslt.Execute(inputfilename, outputfilename)

Or is it the xslt:

<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<!--GST NUMBER IS HARD CODED -->
<xsl:template match="/"><xsl:apply-templates select="Invoice"/></xsl:template>
<xsl:output method="html" omit-xml-declaration="yes" />

<xsl:template match="Invoice">
......
any help would be greatly appreciated, as this is becoming quite frustrating
Rhys :cry:
RhysC
Posts: 2

Thu Mar 17, 2005 6:15 am

OK changing the output line to:

<xsl:output method="html" omit-xml-declaration="yes" media-type="text/html" indent="no" encoding="iso8859-1"/>

..has fixed the problem
george
Site Admin
Posts: 2100

Fri Mar 18, 2005 1:44 pm

Hi Rhys,

The 3 bytes you are getting in the first case are the BOM (Byte Order Mark) for UTF-8. Applications handling UTF-8 as input should also handle the BOM, oXygen does this for instance. Also it is possible to control either the encoding (as you did for solving this problem) or if the BOM should be present if UTF-8 is choosen (this later option for instance is present in oXygen and can be controlled through the Preferences dialog).

Best Regards,
George

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 1 guest