Subject: Re: [xsl] Opera 9.51 doubles <br /> From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Wed, 20 Aug 2008 10:06:13 +0100 |
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.staudinger@xxxxxxxxx>: > 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> > > -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Opera 9.51 doubles <br />, Manfred Staudinger | Thread | [xsl] xsl: Actual output is "" : Ex, Sathasivam, Elayaraj |
Re: [xsl] Unexpected result from <a, Quinn Taylor | Date | [xsl] xsl: Actual output is "" : Ex, Sathasivam, Elayaraj |
Month |