RE: [xsl] Inserting White Space (  ) through XSL.

Subject: RE: [xsl] Inserting White Space (  ) through XSL.
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 3 May 2004 12:11:50 +0100
Why are you using method="xml" to generate HTML? The entity reference & n b
s p ; isn't even defined in XML, so you are creating output formatted as XML
that isn't legal XML.

Are you running this transformation in the browser? 

Why are you declaring the xsl-fo namespace, is it just to confuse your
readers? 

Michael Kay

> -----Original Message-----
> From: Animesh Sharma [mailto:asharma@xxxxxxxxxxxxxxxx] 
> Sent: 03 May 2004 07:45
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Inserting White Space (&nbsp; ) through XSL.
> 
> Stylesheet attached:
> 
> <?xml version= "1.0" encoding= "UTF-8" ?>
> <xsl:stylesheet version= "1.0" xmlns:xsl= 
> "http://www.w3.org/1999/XSL/Transform"; xmlns:fo= 
> "http://www.w3.org/1999/XSL/Format";>
> <xsl:output encoding="UTF-8" method="xml"/>
> 
> <xsl:template 
> match="//body/namespace/form/snip/csf/center/p[position()=1]">
> <xsl:copy>
> <xsl:apply-templates select="*|text()|@*"/></xsl:copy>
> <table border="1" width="300" align="center" cellspacing="5" 
> cellpadding="5">
> <tbody>
> <tr>
> <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
> <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
> <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
> </tr>
> <tr>
> <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
> <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
> <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
> </tr>
> <tr>
> <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
> <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
> <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
> </tr>
> </tbody>
> </table>
> </xsl:template>
> 
> <xsl:template match="*|text()|@*">
> <xsl:copy>
> <xsl:apply-templates select="*|text()|@*"/>
> </xsl:copy>
> </xsl:template>
> 
> </xsl:stylesheet >
> --------------------------------------------------------------
> ----------------------
> Though it doesn't seems to be XSL problem any more. It's 
> browser problem I think. Since, you have asked for it I'm 
> writing the reason here. 
> 
> My Whole AIM was to get an Empty Table With Border around the 
> Cells. in the Output HTML generated after applying XSL.
> 
> Quoted from some Site:
> Empty cells in tables often cause problems to HTML authors, 
> especially since browsers often display such cells without 
> border even if the other cells have borders. There is an 
> often-mentioned trick to solve that problem: put &nbsp; into 
> an empty cell.
> 
> Going by above quotation I tried getting &nbsp; in the 
> output. And I got that using using <xsl:text 
> disable-output-escaping="yes">&amp;nbsp;</xsl:text>.
> But again another problem pop up because output generated is 
> Not a well-formed XML as & get inserted in the output. And I 
> cann't attach More XSL to the output generated. 
> 
> May be I have to find some alternative solution for the above problem.
> 
> Hope I haven't confused you more.
> 
> Regards,
> Animesh
> 
> 
> -----Original Message-----
> From: Julian Reschke [mailto:julian.reschke@xxxxxx]
> Sent: Monday, May 03, 2004 12:58 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Inserting White Space (&nbsp; ) through XSL.
> 
> 
> Animesh Sharma wrote:
> > Thanks Everyone.
> > 
> > As I have already, l had tried "&#160;". But it was not working. 
> 
> If it isn't working, *something else* is wrong. How are you 
> transforming? Server side? Show us the source code.
> 
> > BEcause that iserts white space in the output text. and all 
> browser are intelligent enough to remove the border incase 
> there is no text found in TD element.
> 
> No, it doesn't.
> 
> > FYI, stuff that worked for me is:
> > <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
> > And this inserts &nbsp; in the output. 
> 
> It does, but only with some XSLT engines in some configurations. 
> Meaning, it's not portable.
> 
> Best regards, Julian
> 
> 
> -- 
> <green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760

Current Thread