XML to text (all the etxt on 1 line?)

Here should go questions about transforming XML with XSLT and FOP.
flashmac
Posts: 6
Joined: Wed Aug 08, 2012 7:04 pm

XML to text (all the etxt on 1 line?)

Post by flashmac »

Hi,

I have test.xml and test.xsl, Im interested to see the HTML output, so when i run the debugger (click little blue arrow) the preview text displays all the HTML but sadly its all on one line.

Example that appears all on one line:

Code: Select all

<div class="button-container"><a href="http://updated.games.eu/games.apk" class="first red button"></a><span class="download icon"></span><span class="text"><span class="title">Play Games Now</span></span>
ideally Id like

Code: Select all

<div class="button-container">
<a href="http://updated.games.eu/games.apk" class="first red button"></a>
<span class="download icon"></span>
<span class="text"><span class="title">Play Games Now</span></span>
Anyone know how i can beautify the preview/output window?
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: XML to text (all the etxt on 1 line?)

Post by Costin »

Hello,

Could you please check in your xsl if the value of the "indent" attribute of the <xsl:output/> element is set to "yes" ? The <xsl:output/> element should be a child node of the root (<xsl:stylesheet>). In case you do not yet have the output element in your XSL document, just add it yourself as a direct child of <xsl:stylesheet> and set its indent to yes.

Your stylesheet should start something like:

Code: Select all

<xsl:stylesheet version="x.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output indent="yes"/>
..........................
Then you should have your output indented and should solve your single line display issue.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
flashmac
Posts: 6
Joined: Wed Aug 08, 2012 7:04 pm

Re: XML to text (all the etxt on 1 line?)

Post by flashmac »

Hi Costin,

Thanks for reply.

I already have that, here is how the top of the XSL file looks:

Code: Select all


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
Any other ideas? It's driving me crazy. Cheers
flashmac
Posts: 6
Joined: Wed Aug 08, 2012 7:04 pm

Re: XML to text (all the etxt on 1 line?)

Post by flashmac »

I thought Id post a full full example in the hope it helps. As you can see, the closing <html> tag is on a new line.. no idea why this is and the inside <div> isnt.

XSL FILE

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8"/>

<xsl:template match="mobileSplash"></xsl:param>
<html>
<div id="container">
<xsl:attribute name="class">
<xsl:text>spalsh </xsl:text>
<xsl:value-of select="type/@type"/>
</xsl:attribute>

</div>
</html>
</xsl:template>
.. closing stylesheet tags etc..
TEXT PREVIEW

Code: Select all

<html><div id="container" class="spalsh android"></div>
</html>
flashmac
Posts: 6
Joined: Wed Aug 08, 2012 7:04 pm

Re: XML to text (all the etxt on 1 line?)

Post by flashmac »

wholly crap, i posted the above example without the indent="yes" but trust me its there, I was just removing it to see if it made any diff and then forgot to reapply before i copied and pasted the above post.

oops
adrian
Posts: 2854
Joined: Tue May 17, 2005 4:01 pm

Re: XML to text (all the etxt on 1 line?)

Post by adrian »

Hi,

Are you using Xalan as the transformation engine?
I see that Xalan seems to ignore the xsl:output directive when invoked from the Oxygen debugger. On the other hand it works fine when applying the transformation scenario outside of the debugger.
I've logged this to our issue tracking tool to be analyzed.

As a workaround for this problem please use Saxon 6.5.5 in the Oxygen debugger (you can select it from the combo box on the second row of the toolbar) and the output will be formatted correctly.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
flashmac
Posts: 6
Joined: Wed Aug 08, 2012 7:04 pm

Re: XML to text (all the etxt on 1 line?)

Post by flashmac »

Thanks Adrian, it works!

I could have sworn I tried all the transformation engines but sods law, I must have skipped that one, because it solves the problem.

Thanks for the reply and kind help!

Loving the software so far.
Post Reply