Creating the Shopping Cart—AddToOrder.java

We can take each of these items individually, because that's how they'll be experienced by the user. In this chapter, we'll add an item to the user's shopping cart. To do that, we need him or her to click a link that includes the product_id, so we know which product to add. (We'll take care of the rest of the order process in Chapter 6, “Adjusting Inventory: Using Namespaces and More About DOM.”) Let's add an “Add To Order” link to the product page, as in Listing 5.1.

Listing 5.1. productpage.xsl: The Add To Order Link
...
38:  <br />
39:  <xsl:if test="inventory[@location='showroom']">
40:    <p>Also available in our stores!</p>
41:  </xsl:if>
42:  <hr />
43:  <xsl:element name="a">
					44: <xsl:attribute name="href">AddToOrder?addProduct_id=<xsl: ...

Get XML and Java™ from scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.