xml file that generated by xslt macro is started with an illegal character.
I use xslt macro to generate another xml file. the file is started with an illegal character. the character is unvisible.
The file to generate new xsl file(see the following link because this place can't post it rightly):
http://issues.umbraco.org/issue/U4-8075
By using above method, I can generated one xml content. then save the content as a xml file. but the file can't be parsed because it is started with an illegal character.
If you're getting an error about an illegal character, try checking the output with a Hex editor (or similar) to find out exactly which character is being output.
Here's a couple of ways an illegal character could be output:
If you're outputting the XML declaration (which you are) - it must be the very first thing - so if you save the file and accidentally add a space or a newline, you'll probably get an error from a validating parser
If you're calling a macro in Umbraco, check the first character the template outputs; it's very likely that that's where the problem is.
If you've copied the initial XSLT code from somewhere else (the web, an email, this forum etc.) you could end up with mixed encodings - that could also be a problem
I'm not sure what you're trying to do with the media-type="string" attribute on the <xsl:output> element? If you're generating XML, just let the processor decide.
xml file that generated by xslt macro is started with an illegal character.
I use xslt macro to generate another xml file. the file is started with an illegal character. the character is unvisible. The file to generate new xsl file(see the following link because this place can't post it rightly): http://issues.umbraco.org/issue/U4-8075
By using above method, I can generated one xml content. then save the content as a xml file. but the file can't be parsed because it is started with an illegal character.
Hi Sun,
If you're getting an error about an illegal character, try checking the output with a Hex editor (or similar) to find out exactly which character is being output.
Here's a couple of ways an illegal character could be output:
I'm not sure what you're trying to do with the
media-type="string"
attribute on the<xsl:output>
element? If you're generating XML, just let the processor decide.Hope that helps,
/Chriztian
is working on a reply...