[plt-scheme] servlets and mathml
Jay McCarthy a écrit :
>You must add
>
>(require (lib "response.ss" "web-server"))
>
>to your preamble.
>
>On 12/12/05, Jean-François Trevien <jftrevien at free.fr> wrote:
>
>
Thanks a lot!
I have now a working example with some more modification:
(module test-mathml mzscheme
(require (lib "servlet.ss" "web-server")
(lib "response.ss" "web-server")
(lib "xml.ss" "xml")
)
(provide interface-version timeout start)
(define interface-version 'v1)
(define timeout +inf.0)
(define (make-page body)
(make-response/full
200 "OK" (current-seconds) (string->bytes/utf-8 "text/xml")
'()
(list "<?xml version=\"1.0\"?>"
(xexpr->string
`(html ((xmlns "http://www.w3.org/1999/xhtml")
(xmlns:math "http://www.w3.org/1998/Math/MathML")
)
(head (title "Mathml sample"))
,body)))))
(define (start initial-request)
(make-page
`(body
(p "(a+b)^2 :")
(math ((xmlns "http://www.w3.org/1998/Math/MathML"))
(mrow
(msup
(mfenced (mrow (mi "a")(mo "+")(mi "b")))(mn "2")))
)
(p "sqrt(a+b)^27 :")
(math ((xmlns "http://www.w3.org/1998/Math/MathML"))
(msup
(msqrt
(mrow
(mi "a")(mo "+")(mi "b")))
(mn "27")))
(br)
(math ((xmlns "http://www.w3.org/1998/Math/MathML"))
(mrow
(msup
(mfenced ((open "[")(close "]"))
(mrow
(mi "a")(mo "+")(mi "b")))
(mn "260"))
(mo "+")
(msub
(mfenced ((open "{")(close "}"))
(mrow
(mi "a")(mo "+")(mi "b")))
(mi "i"))))
(br)"pfiou..."
)))
)