Jason McKendry
2010-09-30 09:48:45 UTC
Hello everyone,
I have built an application on top of XOM, and the last thing I haven't been able to iron out over the past few weeks has been a problem with character references and escape sequences to represent non-standard characters in my XML data files. I found information about how to use the xsl:output tag to add a character map, but since the result of each transformation is a XOM Nodes object, the xsl:output tag is never processed. I had to solve a similar problem using the DocType object, but I wasn't having any luck figuring out how to use that knowledge to solve this problem.
So far the best I've been able to come up with is either a way of having the character reference in my XML/XSL resolve to the character in the HTML source (which of course displays garbage in the browser), or to have something like © in the source, which we know renders in the browser as ©. I have only been able to find advice that uses the xsl:output tag at this point.
My (hopefully temporary) workaround has been to cobble together some JavaScript that looks for custom tags in the HTML source via body onload, and then inserts the character with a unicode reference based on that location. It's okay for now, but my client wants to expand to multi-lingual versions of their site, and that will create a maintenance nightmare. Aside from that, I feel as though the XML should be where the actual data lives, not some pointer for a piece of client-side script to look for when I don't even have any assurance that it will always fire.
I've thought about going the other way, and having a custom piece of Java manipulate the output as text files, but that seems kludgy to me, too, and similarly painful to maintain.
I'd be very grateful for any guidance on where to look to solve this problem. Any advice or suggestions would be very welcome. I'm sure in all this time I'm not the only person to run into this!
Thank you,
Jason McKendry
namelessOperation();
I have built an application on top of XOM, and the last thing I haven't been able to iron out over the past few weeks has been a problem with character references and escape sequences to represent non-standard characters in my XML data files. I found information about how to use the xsl:output tag to add a character map, but since the result of each transformation is a XOM Nodes object, the xsl:output tag is never processed. I had to solve a similar problem using the DocType object, but I wasn't having any luck figuring out how to use that knowledge to solve this problem.
So far the best I've been able to come up with is either a way of having the character reference in my XML/XSL resolve to the character in the HTML source (which of course displays garbage in the browser), or to have something like © in the source, which we know renders in the browser as ©. I have only been able to find advice that uses the xsl:output tag at this point.
My (hopefully temporary) workaround has been to cobble together some JavaScript that looks for custom tags in the HTML source via body onload, and then inserts the character with a unicode reference based on that location. It's okay for now, but my client wants to expand to multi-lingual versions of their site, and that will create a maintenance nightmare. Aside from that, I feel as though the XML should be where the actual data lives, not some pointer for a piece of client-side script to look for when I don't even have any assurance that it will always fire.
I've thought about going the other way, and having a custom piece of Java manipulate the output as text files, but that seems kludgy to me, too, and similarly painful to maintain.
I'd be very grateful for any guidance on where to look to solve this problem. Any advice or suggestions would be very welcome. I'm sure in all this time I'm not the only person to run into this!
Thank you,
Jason McKendry
namelessOperation();