<center> <h2>CD Album Report</h2> </center> <?php $root = simplexml_load_file("cdcatalog.xml"); // process each cd foreach ($root->cd as $cd) { printf("<hr><h3>%s</h3>\n", (string)$cd->title); printf("<ul>\n"); foreach ($cd->artist as $artist) printf("<li>artist: %s</li>\n", $artist); if ((double)$cd->price <= 9.00) { printf("<li>price: <span style=\"color: blue\">%s</span></li>\n", (string)$cd->price); } else { printf("<li>price: <span style=\"color: green\">%s</span></li>\n", (string)$cd->price); } printf("<li>year: %s</li>\n", (string)$cd->year); printf("</ul>\n"); } ?>