RE: <BR> a problem for XALAN?

Subject: RE: <BR> a problem for XALAN?
From: "Scott Boag/CAM/Lotus" <Scott_Boag@xxxxxxxxx>
Date: Thu, 10 Aug 2000 10:19:36 -0400
Xalan likes <BR/> fine.

Xalan sends out a startElement/endElement event to the content handler.  If
your stylesheet specifies <xsl:output method="xml"/>, the BR event will be
output as <BR/>.  If you stylesheet specifies <xsl:output method="html"/>,
the BR event will be output as <BR>.  You can type it, <br />, <br></br>,
and <br/>, and it will not matter  -- Xalan processes XML events and
outputs XML events, not a literal translation of your markup (I don't know
of any XSLT processors that do).  What may work is <br dummy=""/>.
Otherwise you need an XHTML serializer, so you can do something like
<xsl:output method="w3c:xhtml"/>.  But, Xalan does not allow you to specify
custom serializers from the stylesheet, at this time.   (Actually, as I
think about it, XalanJ1 does recognize method="xhtml" and tries to use the
Xerces XHTML serializer, but I just tried it and it seems to be broken).

Hmm..., there is one thing you can do.  I went through this with someone
else at some point, and we came up with a convention of recognizing the
public DOCTYPE.

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="xml" indent="yes"
            doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
            doctype-system="DTD/xhtml1-strict.dtd"/>

<xsl:template match="/">
   <HTML>
        <BR/>
   </HTML>
</xsl:template>

</xsl:stylesheet>

This will output:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<HTML>
    <BR />
</HTML>

...with the space before the slash in BR!

-scott




                                                                                                                           
                    "Medina, Edward"                                                                                       
                    <emedina@xxxxxxx>            To:     "'xsl-list@xxxxxxxxxxxxxxxx'" <xsl-list@xxxxxxxxxxxxxxxx>         
                    Sent by:                     cc:     (bcc: Scott Boag/CAM/Lotus)                                       
                    owner-xsl-list@mulber        Subject:     RE: <BR> a problem for XALAN?                                
                    rytech.com                                                                                             
                                                                                                                           
                                                                                                                           
                    08/10/2000 09:28 AM                                                                                    
                    Please respond to                                                                                      
                    xsl-list                                                                                               
                                                                                                                           
                                                                                                                           



:You can try <br/>

Thanks For the information.

However, I have found that for some reason XALAN does not
like any form of <br/> not matter how you type it.  I tried
<br />, <br></br>, and <br/>.  So I had to solve the problem
with <p></p>.  Although <p> should be used for paragraphs, I
have no other choice.

Thanks to everyone for their help, and advice.

Eddy


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





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


Current Thread