Re: including the HTML <BR> in XSL template

Subject: Re: including the HTML <BR> in XSL template
From: Matt Sergeant <matt@xxxxxxxxxxxx>
Date: Thu, 27 Apr 2000 10:07:25 +0100 (BST)
On Wed, 26 Apr 2000, Betty L. Harvey wrote:

> 
> On Wed, 26 Apr 2000, Jay Marvin wrote:
> 
> > I would like to output a <BR> from a template, but am having trouble finding
> > the right way to do it.  What special way do I need to use to get these four
> > characters, "<BR>", out?   I understand it may involve wrapping it in
> > <xml:text>.
> > 
> > <xsl:template match="Line">
> > 	<xsl:value-of select="."/>
> > 	<BR>
> > </xsl:template>
> > 
> > 
> 
> XSL is XML compliant.  Empty elements (even HTML) have to
> be well-formed.  
> 
> This will work:
> 
> <xsl:template match="Line">
>        <xsl:value-of select="."/>
>        <BR/>
> </xsl:template>   
> 
> Either <BR/> or <BR></BR> will work.  This rule is also
> true for the <HR> and <IMG> HTML elements.

For compatibility with all browsers, this is better:

<BR CLASS="hack"/>

Some browsers just don't like the <BR/> format, and display two empty
lines with the <BR></BR> format.

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread