What is the proper way to create a dynamic site map?

Hi all ,
I’m pretty new to site maps . So plz help

I’m going to create a PHP script that automatically generate an XML file named as sitemap.xml … And the script will display another user friendly site map on the website . is that good ?

If this is good , then what is the syntax that the xml site map should be ?
And wt is the proper way of creating it ? is it from PHP script as am doing ? or it would be better if i use another tools ?

Thanks for any trial to help,
Dr Mostafa.