views:

44

answers:

2

Hi all,

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

A: 

Try method="text" and use the newline code(&#10;) where you need it

Zabba
This did not work for me.If I use method="text", then all of the xml I'm producing disappears.If I add only the newline code, then it is being ignored.
Anna
+2  A: 

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.

Tomalak
I fixed the next-step-in-pipeline. Thanks.
Anna