It's great that we can set a parameter for the style sheet, but if we have to run each product page separately, what have we gained? It would certainly be more convenient if we could find a way to run all our pages at once. What we need to do is find a way to create a product page for every product in our XML file.
Fortunately, we can use Java to step through our XML and process the style sheet for each product_id it finds.
The first thing we need to do is parse the document and find out just how many product_ids there are, as in Listing 4.20.
0 :import javax.xml.transform.TransformerFactory; 1 :import javax.xml.transform.Transformer; 2 :import javax.xml.transform.stream.StreamSource; ...