The <br> element is not considered to be an "XHTML element" unless it is in the XHTML namespace. In your case it is in no namespace.

Michael Kay
Saxonica
mike@saxonica.com
+44 (0118) 946 5893



On 8 Jul 2014, at 11:23, Christian Schwaderer <c_schwaderer@hotmail.com> wrote:

Hi all,

I'm a little bit confused about what Saxon 9.5.13 does with empty tags (<br/>) if I set <xsl:output method="xhtml"/>

The specifications say:
"If an element that has no children is an XHTML element with an EMPTY content model, the serializer MUST use the minimized tag syntax, for example <br />, as the alternative syntax <br></br> allowed by XML gives uncertain results in many existing user agents."
http://www.w3.org/TR/xslt-xquery-serialization/#xhtml-output

But given this XSLT file

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="2.0">
   
    <xsl:output method="xhtml"/>
   
    <xsl:template match="/">
        <html>
            <head></head>
            <body>
                Line 1<br/>Line 2
            </body>
        </html>
    </xsl:template>
   
</xsl:stylesheet>


Saxon gives me

<?xml version="1.0" encoding="UTF-8"?><html>
   <head></head>
   <body>
     
      Line 1
     
      <br></br>
      Line 2
     
     
   </body>
</html>

and that is indeed causing problems, because <br></br> is interpreted as TWO line breaks by Browsers. Is this a bug/wrong specification implementation of Saxon?

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help