[plt-scheme] X-expressions, HTML and a nonbreaking space ( )
Actually, I just made a typo in my response because I misread how your
code worked. The symbol nbsp should not be in quotes; it should just be
a symbol directly in your x-expression.
> (define lhtml
`(html
(head
(title "Flight Information"))
(body
(h2 "Item 1")(br) nbsp (h2 "Item 2"))))
> (write-xml/content (xexpr->xml lhtml))
<html><head><title>Flight Information</title></head><body><h2>Item
1</h2><br /> <h2>Item 2</h2></body></html>
-jacob
Arend P. van der Veen wrote:
> Thank you for response Jacob. I tried you suggestion and now it
> generated the following HTML
>
> <html><head><title>Flight Information</title></head><body><h2>Item
> 1</h2><br /> nbsp <h2>Item 2</h2></body></html>
>
> For this to work properly it should have generated instead of
> nbsp. Is there anyway that you are aware of to force the X-expression
> to not escape sequence part of its expression ?
>
> Thanks,
> Arend
>
>
>
> Jacob Matthews wrote:
>
>> Just use the bare symbol nbsp rather than --
>>
>> (define lhtml
>> `(html
>> (head
>> (title "Flight Information"))
>> (body
>> (h2 "Item 1")(br)" nbsp "(h2 "Item 2"))))
>>
>> -jacob
>>
>> Arend P. van der Veen wrote:
>>
>>> For list-related administrative tasks:
>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>
>>> Hi All,
>>>
>>> I have been writing servlets using a response containing an
>>> X-expression representing HTML. I am trying to include a
>>> nonbreaking space ( ) and it is getting escape sequenced
>>> (&nbsp;). Does anybody have any suggestions on how to correct
>>> this ?
>>>
>>> To illustrate the problem please consider the following test program:
>>>
>>> (require (lib "unitsig.ss")
>>> (lib "servlet-sig.ss" "web-server"))
>>>
>>> (unit/sig () (import servlet^)
>>>
>>> (define lhtml
>>> `(html
>>> (head
>>> (title "Flight Information"))
>>> (body
>>> (h2 "Item 1")(br)" "(h2 "Item 2"))))
>>>
>>> lhtml
>>> )
>>>
>>> The servlet generates the following HTML:
>>>
>>> <html><head><title>Flight Information</title></head><body><h2>Item
>>> 1</h2><br />&nbsp;<h2>Item 2</h2></body></html>
>>>
>>> I wanted it to generate the following:
>>>
>>> <html><head><title>Flight Information</title></head><body><h2>Item
>>> 1</h2><br /> <h2>Item 2</h2></body></html>
>>>
>>> The problem is that is getting escape sequenced.
>>>
>>> Thanks for any help in advance,
>>> Arend
>>>
>>
>>
>