anchor.diff:                (sax:end-document cxml::*sink*))))
         (%enstream stream out-str content))))
   
  -(defmacro %with-snippet ((type &optional stream) &body body)
  +(defmacro %with-snippet ((type &optional stream sink) &body body)
     "helper to define with-html-snippet and with-xhtml-snippet"
     (assert (member type '(with-html-document with-xhtml-document)))
     (alexandria:with-unique-names (out-str)
  
positive.code:       `(let  ((,s-name ,stream)) ,content)
        `(with-output-to-string (,s-name) ,content)))
  
  (defmacro buffer-xml-output ((&optional stream) &body body)
    "buffers out sax:events to a sting
  
     xml parameters like <param:foo param:type=\"string\"><div>bar</div></param:foo>
  
negative.code:                 (,type
                    (let ((content (flatten-children (progn ,@body))))
                      (iter (for n in content)
                        (buffer-xml-output (,out-str ,sink) (buildnode::dom-walk cxml::*sink* n))))
                    nil))))
        (%enstream stream out-str body)
        )))
  
  (defmacro with-html-snippet ((&optional stream sink) &body body)
    "builds a little piece of html-dom and renders that to a string / stream"
    `(%with-snippet (with-html-document ,stream ,sink) ,@body))
  
  (defmacro with-xhtml-snippet ((&optional stream sink) &body body)
    "builds a little piece of xhtml-dom and renders that to a string / stream"
    `(%with-snippet (with-xhtml-document ,stream ,sink) ,@body))
  