Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • sun 403 posts 395 karma points
    Feb 26, 2016 @ 13:58
    sun
    0

    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.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Feb 26, 2016 @ 15:31
    Chriztian Steinmeier
    0

    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:

    • 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.

    Hope that helps,

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft