Preserve indentation in xml transformation by msxml

860 views Asked by At

I have an xml file and xsl for it.

When I execute the command

msxml input.xml input.xsl -o output.xml

my output.xml is without indentation. All nodes are in the same line. How can I fix it?

2

There are 2 answers

4
Martin Honnen On

Can you edit the XSLT? Then add

<xsl:output indent="yes"/>

Here is a more complete example:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output indent="yes"/>

  <xsl:template match="/">...</xsl:template>

</xsl:stylesheet>
0
wasmachien On

Unfortunately, MSXML 6's idea of indentation is putting all lines at the same width. Setting indent to 'no' in your XSL file will result in a one-line file.