xslt produces a result that does not end with a carriage return (newline)
I have an xslt script that transforms an xml file to another xml file. The problem I'm having is that the resulting xml file does not end with a newline like a well behaved linux file.
I'm using <开发者_JAVA技巧;xsl:output method="xml" indent="yes"/>
for the code to be nicely idented.
Is there a way to tell xslt that this is Linux mode, and it should add a newline at the end of the output?
Thanks, Anna
Whether or not an XML file ends in a newline should be irrelevant.
However, you can try to add a newline manually, with the equivalent of this:
<xsl:template match="/">
<root>
<xsl:apply-templates select="other/processing" />
</root>
<xsl:value-of select="'
'" />
</xsl:template>
If this does not work for your XSL processor (i.e. the newline gets trimmed), you should consider changing your successive processing chain to ignore the "missing" newline.
Try method="text" and use the newline code(
) where you need it
精彩评论