chickadee » atom » make-atom-doc

(make-atom-doc root #!key (declare-xml? #t) (encoding "utf-8") (headers '())) procedure

Create an Atom Feed Document or Atom Entry Document. ROOT is the atom:feed or atom:entry SXML root node, usually created by make-feed or make-entry. Returns a SXML document representing the entire Atom document, which can be written out using write-atom-doc.

declare-xml?
Whether to add an XML declaration to the document, as a boolean value.
encoding
The encoding to declare in the (optional) XML declaration, as a string.
headers
A list of headers to include in the output document; see below.

Arbitrary headers may be added to the output document. These headers should, generally, be XML processing instructions or comments, since the document must consist of only one root node. For example, you can prepend some stylesheet instructions:

(write-atom-doc
 (make-atom-doc feed
  headers: '((*PI* xml-stylesheet
              "type=\"text/xsl\" href=\"http://3e8.org/styles/atom.xsl\"")
             (*PI* xml-stylesheet
              "type=\"text/css\" href=\"http://3e8.org/styles/atom.css\"")))

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="http://3e8.org/styles/atom.xsl"?>
<?xml-stylesheet type="text/css" href="http://3e8.org/styles/atom.css"?>
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
 ...

Since this procedure just returns a complete SXML document beginning with a *TOP* node, you could instead modify the returned document and add any processing instructions yourself. headers is just a convenient way of doing so.