开发者

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="'&#xA;'" />
</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(&#10;) where you need it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜