Reputation: 58828
With <output method="xml" indent="yes" encoding="UTF-8"/>
xsltproc
produces XML files indented by two spaces. Is it possible to change this to four spaces? Full XSLT:
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<output method="xml" indent="yes" encoding="UTF-8"/>
<strip-space elements="*"/>
<template match="processing-instruction()|@*">
<copy>
<apply-templates select="node()|@*"/>
</copy>
</template>
<template match="*">
<copy>
<apply-templates select="@*"/>
<apply-templates>
<sort select="name()"/>
<sort select="@*[1]"/>
<sort select="@*[2]"/>
<sort select="@*[3]"/>
<sort select="@*[4]"/>
<sort select="@*[5]"/>
<sort select="@*[6]"/>
</apply-templates>
</copy>
</template>
</stylesheet>
Upvotes: 1
Views: 478
Reputation: 116993
Now that I have tested this, I can state that it works (on macOS 10.13.6):
xsltproc '/path/to/stylesheet.xsl' '/path/to/input.xml' | tidy -i -xml --indent-spaces 4
Note that this reformats the transformation result - so it doesn't matter if the stylesheet indents or not.
Upvotes: 1