Unencoded Amazon Web Service data makes XSLT abort
I’ll only admit to being slightly masochistic.
When I set out to create my new bookstore, Magic Amazon Beans, I focused on using XSLT to process the XML replies from Amazon. They have an option to send the results of an XSL transform as a reply instead of their normal XML file. You simply supply the URL of your XSL style sheet with your request and the Amazon servers grab the style sheet, apply it to their XML data and send you the HTML result.
I thought this was a great idea. I wouldn’t have to load down my own server processing the XML data. All my server would do was redirect and cache the HTML from Amazon and serve the XSL style sheet to Amazon’s servers from a static file.
What I thought was the strength turned out to be it’s weakness.
Amazon has to process the reply successfully before I even get a chance to touch the data. As it turns out, Amazon was serving some unencoded data in their XML replies. Things like a copyright symbol were transmitted as a © instead of an ©. When this happened their XSLT processor aborted with an error, and the reply I got was the raw XML data instead of my beautiful HTML. >8(
This is a link to the Amazon XML server that is formatted to demonstrate the problem. You will actually be viewing an HTML reply from the Amazon servers. (You know you wanna try it)
For reasons I’m not completely sure of, I’m a fan of XSLT. There are times when I actually enjoy trying to figure out ways to do things in XSLT that would be simple in other languages. I use Lagoon and XML/XSLT to maintain a website for my wife’s artwork.
I’ll admit that my fondness for XSLT may be masochistic, but I draw the line at trying to process unpredictable data with XSLT.
December 12th, 2004 at 4:28 pm
Could it be that we are drawn to XSLT *BECAUSE* it’s difficult to learn?
Magic Bean Dip ? Blog Archive ? Unencoded Amazon Web Service data makes XSLT abort While sitting at the Skamania Lodge bar and surrounded by a sea of gawking fans (actually I think it was just me, Adam Kinney, and…