[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] break line using stylesheet


Subject: [xsl] break line using stylesheet
From: "Vincent Lapointe" <lapointe_vincent_1975@xxxxxxxxxxx>
Date: Fri, 21 Oct 2005 09:20:36 -0400

Hi all,
I'm pretty new to xml/xsl/html files and have the following problem: I'm using xml and xsl to generate a simple html file. In the generated html document, I want to output some break lines but mozilla firefox doesn't show the same output as internet explorer. In internet explorer the break lines appear as html break lines, but in mozilla the break lines appear as litteral string "<br>".


See below for my xml and xsl files. I also put the desired output and the mozilla output.

I tryed to following modifications in my xsl and xml files:
- I replaced the litteral "&lt;br&gt;" by the litteral "<br>" in my xml file, and it didn't work...
- I replaced the litteral "&lt;br&gt;" by real \n character in my xml file, and it didn't work...
- I replaced the litteral "&lt;br&gt" by the litteral "l&#x0d;&#x0a", and it didn't work...
- I setted the disable-output-escaping attribute to "yes" and "no", and it didn't work with above combination...
- I added the <xsl:preserve-space elements="text"/> in my xsl file and it didn't work with above combination...


I'm using internet explorer 6.0 and mozilla firefox 5.0 (win32 and redhat).

Why I wasn't able to see a break line in mozilla?

Any idea? Thanks for your comments...

Regards,
Vincent

-------------------
test1.xml
-------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test1.xsl"?>
<root>
<text>test1&lt;br&gt;test2&lt;br&gt;test3&lt;br&gt;</text>
<text>test4</text>
<text>test5&lt;br&gt;test6&lt;br&gt;</text>
<text>test7</text>
</root>
-------------------
test1.xsl
-------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="iso-8859-1"/>
<xsl:template match="root">
<html>
<body>
<xsl:apply-templates select="text"/>
</body>
</html>
</xsl:template>
<xsl:template match="text">
<div>
<xsl:value-of select="." disable-output-escaping="yes"/>
</div>
</xsl:template>
</xsl:stylesheet>
-------------------
Desired html output (as in internet explorer)
-------------------
test1
test2
test3
test4
test5
test6
test7
-------------------
Mozilla html output
-------------------
test1<br>test2<br>test3<br>
test4
test5<br>test6<br>
test7



Current Thread
Keywords