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

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

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.