O'Reilly logo

Amazon Hacks by Paul Bausch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Create a Wireless Wish List

Take your Wish List wherever you go with AWS, XSLT, and WAP!

How many times have you been browsing at a bookstore or video store and you can’t remember which books or movies you wanted to pick up? Sure, you could write them all down on a piece of paper and take it with you, but what fun would that be? Instead, you can use powerful cell networks and web applications to do the work for you. If you track wanted books and movies with your Amazon Wish List and have a WAP-enabled cell phone, you can always have your list handy.

WAP stands for Wireless Access Protocol, and it’s used for delivering information to cell phones and other handheld devices. The information itself is formatted with WML (Wireless Markup Language), an XML format.

Just as HTML pages have <body> elements that contain the bulk of the page, WML pages have <card> elements. Each WML page can contain several cards, but only one card is displayed at a time. Also, links work much the same way as in HTML. Instead of <a href> tags, WML relies on <anchor> and <go href> tags. This example creates one card with a list of items. Each item links to the Amazon WAP product detail page for that item.

The Code

Making AWS responses available to a cell phone is just a matter of converting one XML format (AWS response) to another (WML). Once again, Amazon’s XSLT service makes this quick work.

Create an XSL file called wap_wishlist.xsl with the following code:

<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required