Page 1 of 1

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

Posted: Wed Aug 08, 2012 7:13 pm
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?

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

Posted: Wed Aug 08, 2012 9:36 pm
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

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

Posted: Wed Aug 08, 2012 10:24 pm
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

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

Posted: Wed Aug 08, 2012 11:26 pm
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>

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

Posted: Wed Aug 08, 2012 11:36 pm
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

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

Posted: Thu Aug 09, 2012 11:14 am
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

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

Posted: Fri Aug 10, 2012 4:05 pm
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.