|
|
 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, win occasional prizes given to our best members, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
 |
|
|
 |

February 2nd, 2006, 05:58 AM
|
|
Registered User
|
|
Join Date: Feb 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Blank Space in XSLT
Hi everybody,
How to create a blank space in XSLT? I used #160; When I use .NET iT displays  Character in the blank sapce
I have tried
#x20; and it does not produce ? but does not create a space.
Please Help me
|

February 2nd, 2006, 06:39 AM
|
 |
Wrox Author
Points: 15,993, Level: 54 |
|
|
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,532
Thanks: 0
Thanked 197 Times in 194 Posts
|
|
You can create a single space using
<xsl:text> </xsl:text>
or if you prefer greater visibility,
<xsl:text>#x20;</xsl:text>
Note that if you are generating HTML, multiple spaces in the HTML file will display as a single space in the browser.
You can create a non-breaking space using
#xa0; (or #160;)
This does not require an xsl:text element because it is not treated as whitespace by the XSLT processor.
If the non-breaking space displays incorrectly when you view the resulting HTML (either in a browser or in a text editor - you didn't say which) then this is because your configuration is set up incorrectly. It looks as if you have generated the HTML in UTF-8 encoding, and have then displayed it using software that thinks the encoding is iso-8859-1 or something similar (perhaps Microsoft cp1252).
One way to avoid such encoding problems is to specify <xsl:output encoding="us-ascii">. This will force a non-ASCII character such as NBSP to be output as a chararacter reference or entity reference.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|

April 9th, 2012, 02:20 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Blank Space - this worked for me
<xsl:text disable-output-escaping="yes"> <![CDATA[ ]]> <![CDATA[ ]]> <![CDATA[ ]]><![CDATA[ ]]> <![CDATA[ ]]><![CDATA[ ]]> <![CDATA[ ]]> <![CDATA[ ]]></xsl:text>
Each <![CDATA[ ]]> creates one blank space. I tried all the other suggestions on the internet and this was the only one that worked for me. I hope this helps!

|

April 9th, 2012, 02:29 PM
|
 |
Wrox Author
Points: 15,993, Level: 54 |
|
|
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,532
Thanks: 0
Thanked 197 Times in 194 Posts
|
|
I don't know if you were intentionally contributing to a thread that's been dormant for six years. But in any case, your contribution is unhelpful; this mess of disable-output-escaping and CDATA is totally unnecessary.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |