Page 1 of 1

xslt transformation (xml to xml), line break issue

Posted: Sun May 18, 2008 5:17 pm
by ericlilja
Hello, I'm using version 9.2 and I'm using xslt (version 1) to transform an xml document to a new xml document. The new xml document contains the data I want but it's all on a single line, and I mean everything is one a single line, even the xml-declaration. I have to manually perform a "format and indent" on the generated xml file for it to become pleasing to my eye. Did I do something wrong in my xsl-file or what can I do here? Oh, and btw, I'm very new to xslt.

- E

Re: xslt transformation (xml to xml), line break issue

Posted: Mon May 19, 2008 2:05 pm
by sorin_ristache
Hello,

The format of the transformation output is set by your XSLT stylesheet. If you want to indent the output so that it is easy to read you should use the xsl:output element with the indent="yes" attribute in the stylesheet:

Code: Select all

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>

...

</xsl:stylesheet>
Regards,
Sorin

Re: xslt transformation (xml to xml), line break issue

Posted: Sun Aug 03, 2008 5:30 pm
by cashreadbob
Even i have the similar problem.Using XSLT iam trying to transform an XML into another XML of different format.iam getting the O/P as

<media:description type="plain">Show Title: FN DishHost(s): Adam RobertsShow Description: Here is the decription of the show. Here is the decription of the show. Here is the decription of the show. Here is the decription of the show. Here is the decription of the show.</media:description>

if i use <br/> in xslt then the O/P would be

<media:description type="plain">
<br />
Show Title: FN Dish
<br />
Host(s): Adam Roberts
<br />
Show Description: Here is the decription of the show. Here is the decription of the show. Here is the decription of the show. Here is the decription of the show. Here is the decription of the show.
</media:description>

but i need the O/P to be
<media:description type="plain">
Show Title: FN Dish
Host(s): Adam Roberts
Show Description: Here is the decription of the show. Here is the decription of the show. Here is the decription of the show. Here is the decription of the show. Here is the decription of the show.
</media:description>

i mean to say the description variable in XSLT should display its values in separate lines in XML O/P file without <br/> statement


ericlilja wrote:Hello, I'm using version 9.2 and I'm using xslt (version 1) to transform an xml document to a new xml document. The new xml document contains the data I want but it's all on a single line, and I mean everything is one a single line, even the xml-declaration. I have to manually perform a "format and indent" on the generated xml file for it to become pleasing to my eye. Did I do something wrong in my xsl-file or what can I do here? Oh, and btw, I'm very new to xslt.

- E