O'Reilly logo

XML and Java™ from scratch by Nicholas Chase

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

Working with the Results of the Transformation

Now that we've retrieved the information, we still need to massage it. We need to add extended prices based on quantity for each item, as well as a final total price. To do that, we must get the results of the first transformation as a document, instead of just the output text. Therefore, we need to make some changes to both the servlet and the style sheet. Listing 6.28 shows the changes to ReviewOrder.java.

Listing 6.28. ReviewOrder.java: Outputting the Temporary Document
 ... 106: Node productRoot = products.getFirstChild(); 107: processNode(productRoot, out, orderSystem, newDoc, 108: "http://www.nicholaschase.com/products/", "prod:"); 109: 110: TransformerFactory transFactory = 111: TransformerFactory.newInstance(); ...

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