You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Tim Cronin <ti...@13-colonies.com> on 2003/01/31 19:02:43 UTC

transform collapsing Element

when I transform and xsl stylesheet to convert it to a string
empty elements get collapsed 

the following
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method = "html"/> 
  <xsl:template match="/">
  <table cellpadding="0" cellspacing="0" border="0"><tr><td
height="30"></td></tr></table>
  </xsl:template>
</xsl:stylesheet>

becomes this  when I transform it to system.out
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method = "html"/> 
  <xsl:template match="/">
  <table cellpadding="0" cellspacing="0" border="0"><tr><td
height="30"/></tr></table>
  </xsl:template>
</xsl:stylesheet>

is there a way to prevent this

Re: transform collapsing Element

Posted by Joseph Kesselman <ke...@us.ibm.com>.
Set your styleheet's output mode to HTML. The default is XML, and in XML 
there is no meaningful difference between <foo></foo> and <foo/>.

______________________________________
Joe Kesselman  / IBM Research


Re: transform collapsing Element

Posted by Joseph Kesselman <ke...@us.ibm.com>.
Sorry -- you *did* set the output mode to HTML, but you missed the fact 
that it's case-sensitive. "HTML" wasn't recognized so we defaulted back to 
XML output. Try:

        <xsl:output method="html"/>

______________________________________
Joe Kesselman  / IBM Research