[xslt] re: <br></br> empty elements



Igor Zlatkovic wrote:

-----------------------
   C:\Home\Igor\tmp> xsltproc --version
   Using libxml 20507, libxslt 10030 and libexslt 720

   C:\Home\Igor\tmp> type tmp.xsl
   <?xml version="1.0"?>
   <xsl:stylesheet version="1.0"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform";;>
     <xsl:output method="html"/>
     <xsl:template match="/">
       <br/>
       <br></br>
     </xsl:template>
   </xsl:stylesheet>

   C:\Home\Igor\tmp> type tmp.xml
   <?xml version="1.0"?>
   <doc/>

   C:\Home\Igor\tmp> xsltproc tmp.xsl tmp.xml
   <br><br>

Both cases are transformed correctly, without the closing tag. Where 
is the problem?

-----------------

Hah! Depends on which postman, it seems :)
What I was doing was using the html namespace; add it to your example 
as follows:

<?xml version="1.0"?>
   <xsl:stylesheet version="1.0"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
       xmlns="http://www.w3.org/TR/html4/strict";>
     <xsl:output method="html"/>
     <xsl:template match="/">
	<html>
       <br/>
       <br></br>
       </html>
     </xsl:template>
   </xsl:stylesheet>

and you get 

<html 
xmlns="http://www.w3.org/TR/html4/strict";><br></br><br></br></html>

Agreed, for my purposes, I can easily remove the namespace 
declaration, but as the default output for method=html is 4.0, output 
with and without namespace declaration should be identical, shouldn't 
they?

(and, yes, I have now upgraded to the latest version ;-)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]