Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between   and  ?

Tags:

I have written one XSLT to transform xml to html. If input xml node contains only space then it inserts the space using following code.

<xsl:text>&#xa0;</xsl:text> 

There is another numeric character which also does same thing as shown below.

<xsl:text>&#160;</xsl:text> 

Is there any difference between these characters? Are there any examples where one of these will work and other will not?

Which one is recommended to add space?

Thanks,
Sambhaji

like image 492
Sambhaji Avatar asked Sep 22 '11 07:09

Sambhaji


1 Answers

&#160; is a non-breaking space (&nbsp;).

&#xa0; is just the same, but in hexadecimal (in HTML entities, the x character shows that a hexadecimal number is coming). There is basically no difference, A0 and 160 are the same numbers in a different base.

You should decide whether you really need a non-breaking space, or a simple space would suffice.

like image 166
kapa Avatar answered Nov 21 '22 23:11

kapa