Please see WordPress Sitemap Class for the main write-up and code examples.
The class file is slightly different to cope with PHP 4 limitations, but with the same class features. There’s one main difference in it’s usage, and that it that methods can’t chain together:
require_once 'classes/GT_Sitemap.php';
$sitemap = new GT_Sitemap;
$sitemap->setOrder('posts', 'pages');
$sitemap->setDateFormat('');
$sitemap->setCustomPagesQuery('exclude=812');
$sitemap->shortcode('sitemap');