Hi Andrew, Thanks for the quick response! The application does lot of XML/XSL processing along the flow. We had lot of problems because of these special characters. And there are lot of other factors involved in the application, like encoding of DB, terminal. And actually, the source xml has special characters directly referenced (like ®). So, we thought the application will safe if we convert the directly referenced special characters to their entity references. The source xml has "windows-1242" encoding. This is the ONLY solution worked effectively. I am not sure if this is an effective way of doing, but this works.
Do you have any suggestions on how to handle such special characters? Reg'g replacing thing, here is a sample thing I want to achieve: <root> <description> Rugged and Ready ®even ±0.5 dB works underwater (up to 5 ft.) </description> </root> And the resultant should be: <root> <description> Rugged and Ready &#174;even &#202;0.5 dB works underwater (up to 5 ft.) </description> </root> As I said, the xsl code I presented in my previous email works, but I need to replace the 2 strings in a SINGLE shot, to make the processing fast and efficient. Thanks, Pramodh. ----- Original Message ----- From: "Andrew Welch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, January 14, 2004 11:46 AM Subject: RE: replacing ALL chars in a string while transforming > Do we have any way to replace ALL different characters in > String with other characters in ONE SINGLE shot? > Example: I have a String "® ™" and the resulting > String should be "&#174; &#8482;". Which means > '®' should be replaced by '&#174;', '™' should > be replaced by '&#8482;'. Are you sure this is what you want to be doing?? If you want the character reference to appear in your output, the usual technique is to use an encoding that doesn't contain the character your are referencing, thereby forcing the serialiser to output a reference. For example, the stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output encoding="ascii"/> <xsl:template match="/"> ® ™ </xsl:template> </xsl:stylesheet> Will output: <?xml version="1.0" encoding="ascii"?> ® ™ As the ascii encoding doesn't contain (r) and TM. Alternatively, use any encoding you like and ensure the app you are using to view the result of the transform is reading it in the same encoding. So if you are viewing the result in IE, use a <meta> tag to specify the encoding (or just right click -> encoding to see whats going on) Maybe a sample xml, sample xslt and the result you need would explain what youre after a little better cheers andrew