+<%
+ doc_str = yield()
+ doc = Nokogiri::XML(sprintf("<html xmlns='%s'>%s</html>",
+ Xmlns['xhtml'], doc_str))
+
+ doc_header = nil
+ if !doc.xpath("//xhtml:h1", Xmlns).empty? then
+ doc_header = doc.xpath("string(//xhtml:h1)", Xmlns)
+ end
+%><document>
+ <title><%= @item.fetch(:title, doc_header) %></title>
+<% [@item.fetch(:copyright, [])].flatten.each do |copyright|
+%> <copyright><%= copyright %></copyright>
+<% end
+ if @item[:license] then
+ lic = find_license(@item[:license])
+%> <license>
+ <identifier><%= File::basename(lic.identifier.without_ext) %></identifier>
+ <name><%= lic[:title] %></name>
+ <uri><%= item_uri(lic) %></uri>
+ <modification-allowed><%=
+ lic[:"modification-allowed"] == true ? "yes" : "no"
+ %></modification-allowed>
+ </license>
+<% end
+%> <source>