Yoni Trumper

Yoni Trumper

  • NA
  • 1
  • 2.2k

remove extra cr\lf from XSL transformed XML with indent=yes

Jan 9 2013 8:31 AM
We transform an XML using XSL into another XML structure.
at first the result XML turned out with no line break after each XML element.
then we added method="xml" indent="yes", and we got our line breaks in place.

however, it turns out that the transformation engine added an extra line break (cr\lf) before each one of the elements (That includes the xml header element).

we wanted:
<node>
   <subnode id=1>text</subnode>
   <subnode id=2>text</subnode>
   <subnode id=3>text</subnode>
</node>


at first we got:
<node><subnode id=1>text</subnode>
<subnode id=2>text</subnode><subnode id=3>text</subnode></node>

we added indent=yes and got:

<node>

   <subnode id=1>text</subnode>

   <subnode id=2>text</subnode>

   <subnode id=3>text</subnode>


</node>

Any idea of how to get a linebreak between xml elements, but not an extra one?