sxml2html added by mario-goulart on Wed Jan 31 20:15:34 2024

$ cat sxml2html.scm 
(import (chicken port))
(import sxml-transforms)

(define sxml->html
  (let ((rules `((literal *preorder* . ,(lambda (t b) b))
                 . ,universal-conversion-rules*)))
    (lambda (sxml)
      (with-output-to-string
        (lambda ()
          (SRV:send-reply (pre-post-order* sxml rules)))))))

(print
 (sxml->html
  '(html
    (head
     (title "the title"))
    (body
     (div (@ (id "content"))
          (p "stuff here"))))))


$ csi -s sxml2html.scm 

<html>
<head>
<title>the title</title></head>
<body>
<div id="content">
<p>stuff here</p></div></body></html>