The Final Style Sheet

The actual display page needs to do three things: show the user what she has ordered, allow her to change it, and collect payment information.

Let's start off by modifying our servlet to send the output through our new style sheet in Listing 6.36.

Listing 6.36. ReviewOrder.java: Outputting to the Final Style Sheet
...
150:        totalCostNode.appendChild(totalCostText);
151:        tempDocRoot.appendChild(totalCostNode);
152:
153:      transformer = transFactory.newTransformer
					154:              (new StreamSource("file:///c:/files/confirmOrder.xsl"));
					155:      transformer.transform(new javax.xml.transform.dom.DOMSource(tempDoc),
					156:                                               new StreamResult(out)); 157: 158: } catch (org.xml.sax.SAXException SAXe) { 159: out.print("There was a problem with the source" ...

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.