Subject: Re: [xsl] formatting of identity transformation From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 3 Apr 2003 23:08:00 +0100 |
Hello- I am doing a modified identity transformation from 1 xml doc to another. But, in the resulting xml file, everything seems to basically be on one long running line. How do I create line breaks in the xml doc I am writing? Thanks- Mac It depends whether it just seems to be on one line, or _is_ on one line. If you use an unmodified identity transform (eg the one from the xslt spec) then all character data including newlines and other white space (that's in character data, not inside tags, between attributes etc) should be preserved, so <x> </y> should come out as <x> </y> although <x a="b" /> might come out as <x a="b"/> So if that is not happening then one of the following is happening Your "modification" of the identity transform has made it remove white space (hard to say without seeing it) or The white space is being removed from the input file before XSLT sees the input so it copies the version without the spaces in. Microsoft's parser is notorious for this it helpfully optimises your input document by throwing away white space whether or not you wanted it. If you are calling the parser from script you can set preserveWhiteSpace (possibly with different capitilisation, check the docs) to get a more conformant behaviour. or the ends of lines are there but your XSLT system is confused about your OS, so it's adding unix line ends (#10) rather than windows ones (#10#13 pairs ) and your editor doesn't understand these breaks so you see it all on one line or something else Note some people have suggested adding indent="yes" which may get you the output you want, but doesn't _preserve_ the original breaks, it just adds some new ones where they might be useful. David XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] formatting of identity tr, Wendell Piez | Thread | [xsl] testing for descendants probl, Mac Martine |
RE: [xsl] data vs. xml, David Carlisle | Date | [xsl] FO stylesheets for xhtml, Ismael Olea |
Month |