xml.instruct!
xml.urlset "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", 
    "xsi:schemaLocation" => "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd", 
    "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do

  links.each do |link|
    xml.url do
      xml.loc         link[:loc]
      xml.lastmod     w3c_date(link[:lastmod])
      xml.changefreq  link[:changefreq]
      xml.priority    link[:priority]
    end 
  end
 
end
xml.instruct!
xml.urlset "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", 
  "xsi:schemaLocation" => "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd", 
  "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do

  links.each do |link|
    xml.url do
      xml.loc        link[:loc]
      xml.lastmod    w3c_date(link[:lastmod]) if link[:lastmod]
      xml.changefreq link[:changefreq]        if link[:changefreq]
      xml.priority   link[:priority]          if link[:priority]
    end 
  end

end

Allow empty lastmod, changefreq and priority.
Allow empty lastmod, changefreq and priority.

Provide a way to pass false values to lastmod, changefreq and priority.

Signed-off-by: Adam Salter <f257d94038124c89b9e3063ebb3ccaafdcb43ccb@gmail.com>