[bknr-cvs] hans changed trunk/bknr/web/src/web/web-macros.lisp

BKNR Commits bknr at bknr.net
Tue Mar 3 21:36:05 UTC 2009


Revision: 4326
Author: hans
URL: http://bknr.net/trac/changeset/4326

Add xmlns keyword argument to WITH-XML-RESPONSE macro

U   trunk/bknr/web/src/web/web-macros.lisp

Modified: trunk/bknr/web/src/web/web-macros.lisp
===================================================================
--- trunk/bknr/web/src/web/web-macros.lisp	2009-03-02 17:19:33 UTC (rev 4325)
+++ trunk/bknr/web/src/web/web-macros.lisp	2009-03-03 21:36:05 UTC (rev 4326)
@@ -104,7 +104,7 @@
 
 (defvar *xml-sink*)
 
-(defmacro with-xml-response ((&key (content-type "text/xml; charset=utf-8") root-element xsl-stylesheet-name)
+(defmacro with-xml-response ((&key (content-type "text/xml; charset=utf-8") root-element xsl-stylesheet-name xmlns)
                              &body body)
   `(with-http-response (:content-type ,content-type)
      (with-query-params (download)
@@ -114,10 +114,12 @@
      (with-output-to-string (s)
        (let ((*xml-sink* (cxml:make-character-stream-sink s :canonical nil)))
          (cxml:with-xml-output *xml-sink*
-           ,(when xsl-stylesheet-name
-                  `(sax:processing-instruction *xml-sink* "xml-stylesheet"
-                                               ,(format nil "type=\"text/xsl\" href=\"~A\"" xsl-stylesheet-name)))
+           ,@(when xsl-stylesheet-name
+                  `((sax:processing-instruction *xml-sink* "xml-stylesheet"
+                                                ,(format nil "type=\"text/xsl\" href=\"~A\"" xsl-stylesheet-name))))
            ,(if root-element
                 `(cxml:with-element ,root-element
+                   ,@(when xmlns
+                           `((attribute "xmlns" ,xmlns)))
                    , at body)
                 `(progn , at body)))))))
\ No newline at end of file





More information about the Bknr-cvs mailing list