xsl-list
[Top] [All Lists]

RE: break line using stylesheet

2005-10-21 07:09:28
To output <br> in your HTML, just write <br/> in your stylesheet. It's as
easy as that.

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Vincent Lapointe [mailto:lapointe_vincent_1975(_at_)hotmail(_dot_)com] 
Sent: 21 October 2005 14:21
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] break line using stylesheet

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 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>