[xsl] Opera 9.51 doubles <br />

Subject: [xsl] Opera 9.51 doubles <br />
From: "Manfred Staudinger" <manfred.staudinger@xxxxxxxxx>
Date: Wed, 20 Aug 2008 02:24:19 +0200
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>

Current Thread