[XSLT] How to add a non-breaking space to HTML output?
Posted on 2003-12-02
Okay, simple problem. I have an XML file linked to an XSL file. The XML file will be opened in Internet Explorer 6 and this shoudl result in a client-side transformation of a small data file with a small transformation file into what would be a very large HTML page. The HTML output is quite big because of the use of colors, tables and lots of formatted fields. And because the internet connection and server are a bit slow while the clients are pretty fast, I need this client-side transformation. Fortunately, IE does this automatically.
However, there will also be some users who need the XML file to be translated server-side because they use either a different webbrowser or an older webbrowser that doesn't support XML. These users might not even have any Unicode support on their system.
However, my problem is that I need tags in the HTML output too. If I just use then IE will not transform my XML file but just report an error. I tried to use &nbsp; but IE then generates instead of the required blank space. I could use   and this seems to give the correct result but it's still not exactly what I need.
Sure, the HTML output will convert   to a NBSP but it generates it as a unicode character and not as the tag. I can't allow the NBSP to be hardcoded in the output as an Unicode character because some people would just see 'Â ' in their output. Yes, a funny A followed by a space... So, for those users who need the pre-translated file I need to have in my output file.
Now, how to do this with XSLT??? How to keep unicode out of my output file?