guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to render raw data using sxml?


From: Matt Wette
Subject: Re: How to render raw data using sxml?
Date: Wed, 13 Jul 2016 05:28:02 -0700

> On Jul 10, 2016, at 12:58 PM, Jakub Jankiewicz <address@hidden> wrote:
> 
> Hi,
> 
> I want to render scheme code inside script tag to be executed by biwascheme
> in the browser so I've try to create simple page using sxml (cgi script):
> 
> (display "Content-Type: text/html")
> (newline)
> (newline)
> (display "<!DOCTYPE html>")
> (newline)
> (sxml->xml `(html
>              (head
>                 (title "BiwaScheme test")
>                 (script (@ (src "biwascheme-min.js")) "(display \"hello\")"))
>              (body (p "BiwaScheme test"))))
> 
> but the output was:
> 
> <!DOCTYPE html>
> <html><head><title>BiwaScheme test</title><script
> src="biwascheme-min.js">(display
> &quot;hello&quot;)</script></head><body><p>BiwaScheme test</p></body></html>
> 
> which is invalid scheme code. I've also try this:
> 
> (script (@ (src "biwascheme-min.js")) "(display " #\" "hello" #\" ")")
> 
> but got the same result. How can I display raw data using sxml->xml

I googled “sxml CDATA” and found that Chicken Scheme has a “sxml-serialize” 
procedure that takes an optional keyword argument cdata-section-elements which 
is a list of elements which should have contents serialized to a CDATA section. 
  It seems like if sxml->xml had something like that you might have a solution. 
  Does <script><![CDATA[(display “hello”)]]></script> work on HTML?

Matt




reply via email to

[Prev in Thread] Current Thread [Next in Thread]