xsl-list
[Top] [All Lists]

Re: [xsl] Opera 9.51 doubles <br />

2008-08-20 04:06:40
At the moment you're outputting everything in the xhtml namespace by
copying the html element from the input:

<html xmlns="http://www.w3.org/1999/xhtml";>

...which is probably causing <br> to be output as <br></br> which when
it's parsed with an HTML parser, it will read two of them.

I would suggest adding a template for <html> that strips out the
namespace, so you're outputting proper HTML and hopefully you'll then
just a get single empty "<br>" in the output.




2008/8/20 Manfred Staudinger <manfred(_dot_)staudinger(_at_)gmail(_dot_)com>:
Hi,

With Opera 9.51 and using xsl:output method="html" _every_ <br />
results in 2 consecutive br elements in the DOM, and in turn in an
extra blank line. The same XML and XSLT (see below) works fine for
Opera 9.27, Firefox (from 1.0.4 up to 3.0.1) and IE-6 (MSXML3) [1].

The problem vanishes if I switch to xsl:output method="xml". But this
would produce a true xhtml which is not yet supported by an external
javascript I want to use (ga.js from Google-Analytics).

Does anyone know this problem? or have suggestions for a workaround?
Many thanks in advance,

Manfred

[1] Actually the "xhtml:br" in the match pattern below is a workaround
for a very similar problem in IE 6.

XML:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="test-br.xsl" type="text/xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
     <title>Test Opera br</title>
  </head>
  <body>
     <p>text before break<br />text after break</p>
  </body>
</html>

XSLT:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
  xmlns:xhtml="http://www.w3.org/1999/xhtml";
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="html"
  encoding="UTF-8" omit-xml-declaration="yes" indent="no"/>

<xsl:template match="/">
  <xsl:apply-templates/>
</xsl:template>
<xsl:template match="*">
  <xsl:copy>
     <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>
<xsl:template match="@*|text()|comment()|xhtml:br">
  <xsl:copy/>
</xsl:template>

</xsl:stylesheet>

--~------------------------------------------------------------------
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>
--~--





-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
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>