Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML not supporting Symbol: Work around

Status
Not open for further replies.

Earth

Technical User
May 8, 2000
59
AU
Hi all

I'm new to XML.

I'm supporting a website that displays XML pulled out of a database.

The problem is that some rows in the database in a particular field that is returned contain the registered trade mark symbol (<Item>NyItemNameTM</Item>).

I have pulled sample XML out and changed the symbol into &#8482; - which works fine. I understand that the symbol is not a valid character in XML.

The problem is that I don't know how to automate this process - I have no control over what data is in the database, or what data is returned.

I'm guessing this has something to do with transformation in the xsl or xslt stylesheets, but I'm a little bit lost.

Any guidance, including links to good reading on this topic, would be much appreciated.

Thanks
Earth
 
For XML to be transformed with XSL it has to be valid in the first place. You'll have to change the either the data in the database, the SQL (or whatever query language is used) or create a program or script that will do it when you get it. Depends on how you get the data and how much control you have over the database/queries.

Jon

"There are 10 types of people in the world... those who understand binary and those who don't.
 
I have no control over the data, the database, or the xml that is produced. Is there no way to change, for example,

<xmlstuff>
<Item>MyItemName™ Is Tradmarked</Item>
</xmlstuff>

Into
<xmlstuff>
<Item>MyItemName&#8482; Is Tradmarked</Item>
</xmlstuff>

through XSL/XSLT?

Thanks for your reply Jon.
 
Apparently ™ is valid XML.

Jon

"There are 10 types of people in the world... those who understand binary and those who don't.
 
Jon
Thanks for your help. It was my mistake - not saving the XML in unicode.

Kind Regards
Earth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top