p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   I gotta be missing something... (http://p2p.wrox.com/showthread.php?t=5311)

tomaney October 23rd, 2003 03:13 AM

I gotta be missing something...
 
Using a trasform, all I want to do is have html format that actually has the text " " or "#160;". I.e. given:

<xmldata>Joe</xmldata>

I want a transform that gives me a result exactly like this:

<html><body><p>Dear#160;#160;Joe</p></body></html>


joefawcett October 23rd, 2003 05:58 AM

This is not easy to do without dubious features such as disable-output-escaping although you could try an escaped ampersand (ampersand amp semi-colon) and then #160;. Why bother though? If you use ampersand hash 160 semi-colon in your stylesheet it will output a non-breaking space that should work in the browser.

Joe (MVP - xml)

tomaney October 23rd, 2003 08:42 AM

I have to get the exact characters below because the final target is not a browser, but rather MS Word...and MS Word seems the ignore the non-breaking spaces that the browser does recognize. I've tried escaping the ampersand but then, of course, Word shows the literial characters #160; in the result....

This is driving me nuts...a client simply want's two spaces between sentences and I can't stomach telling them "I can't do that"...


armmarti October 23rd, 2003 09:25 AM

Ok,

As Joe mentioned, using disable-output-escaping mechanism is risky, since the XSLT specification doesn't enforce implementations (XSLT engines) to support the mechanism. However, to output two consecutive nb spaces, write:
Code:

<xsl:text disable-output-escaping="yes">&amp;#160;&amp;#160;</xsl:text>
Regards,
Armen

tomaney October 23rd, 2003 11:26 AM

Yeeha...that worked and I going with it! Thanks!! I'm so embarassed at getting stuck on this. [:I]


tomaney October 23rd, 2003 12:05 PM

for your entertainment, I was about to go with:

<span style="color:white">__</span> :)



All times are GMT -4. The time now is 12:13 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.