code to extract the results to an html doc