The examples here are referenced in an accompanying article titled Generating a sitemap for a static site.
To use, simply download the two files, cd
to your document root, and run with a command like:
$ php ~/bin/sitemap-generator/generate.php . > sitemap.xml