Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make xsl transformation indent the output?

I'm using xalan with the following xsl header:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0"
    xmlns:redirect="http://xml.apache.org/xalan/redirect"
    extension-element-prefixes="redirect"
    xmlns:xalan="http://xml.apache.org/xalan">
<xsl:output method="text" indent="yes" xalan:indent-amount="4"/>

And the output is not indented.

Anyone with ideas?

like image 692
Vincent Avatar asked Mar 08 '10 15:03

Vincent


1 Answers

For indentation you need to use a different namespace: http://xml.apache.org/xslt (see this issue)

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
extension-element-prefixes="redirect"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" indent="yes" xalan:indent-amount="4"/>
like image 85
Jirka Avatar answered Sep 27 '22 20:09

Jirka