# Thursday, April 20, 2006

I just spent a TON of time fighting an XSLT stylesheet. This is a long established system that needed a tiny change -- the customer wanted the little R-in-a-circle symbol after one of their trademarks. No problem, right? Go on into the XSLT and put ® in the appropriate place. Not an entity known to XSLT. Right, I remember that. But heh heh you can't stop me: ® should do it. Test in XML Spy and there's the symbol. Generate and upload all the pages and -- yikes! -- everything says ? where it should say ®! I don't think my clients want the header on every web page to say REALTOR? -- a little certainty is wanted here. That's because XSLT is putting the actual symbol into the HTML -- if you do a View Source on the web page there's no entity, there's the actual symbol and some browsers can show it and some can't. OK, let's try ® or ® -- they come out looking just like that on the screen. Bleah. More Googling. Suggestions to define DOCTYPES and ENTITYs that all manage to stick the symbol into the HTML but not the entity. A brief attempt at some circular definitions of reg to reg, some desparate CDATA flailing -- and then we got it:

Literal text in the middle of the XSL stylesheet:

REALTOR<xsl:text disable-output-escaping="yes">&amp;</xsl:text>reg;

We have a winner. I get &reg; in the HTML and my client gets their trademark.


Thursday, April 20, 2006 6:51:50 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [2]
Monday, April 24, 2006 8:26:22 AM (Eastern Daylight Time, UTC-04:00)
Definitely useful for future reference, thanks!
Friday, June 12, 2009 12:54:28 PM (Eastern Daylight Time, UTC-04:00)
Thank you. This was handy.
Comments are closed.