[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: formatting of identity transformation
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|