Subject: Re: [xsl] Wrong indentation with javax.xml.transform.Transformer From: Philip Fearon <pgfearo@xxxxxxxxxxxxxx> Date: Wed, 21 Sep 2011 11:33:06 +0100 |
Just an observation on pretty-printing issues: If you, or users of your output, were using a virtual formatting viewer or editor (which just extends the left-margin to indent) you wouldn't care about the pretty print formatting characters. You would simply view/edit the XML in the formatting style set in the virtual formatter. The preference then would be to set the INDENT property of transformer to "no", but otherwise the virtual formatter would remove the pretty-print characters for you anyway to ensure the view (but not the text) was properly formatted. So far as preserving the integrity of the XML content goes: generally, its safer to trim formatting characters than to add them. This is because the pattern of leading whitespace characters can actually be exploited by the trimming algorithm to ensure only pretty-print whitespace is removed. Unless a schema can be exploited, a pretty-printer doesn't have the equivalent information to prevent it adding whitespace to unformatted XML where it shouldn't. For this reason, I use code to ensure that the XSLT processor I use never indents the XML output, even when xsl:output settings in the XSLT request otherwise. The only thing the virtual formatter then does to the XML is insert formatting line-feeds if required. Phil Fearon http://qutoric.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Wrong indentation with , Olivier Lefevre | Thread | [xsl] [ANN] XML Amsterdam 2011 conf, Geert Josten |
[xsl] Re: Wrong indentation with , Olivier Lefevre | Date | Re: [xsl] Template mode value from , Martynas Jusevicius |
Month |