[plt-scheme] using pi structs in xml.ss
Rather than using make-pi, you can use make-pcdata or make-cdata. The
xexpr->xml function will not quote the strings in these structures.
Jay
On 11/21/06, wayne at taxupdate.com <wayne at taxupdate.com> wrote:
> I apologize--I should have given more context to my question. I'm using the
> xml.ss package to generate html/php web pages. The pages get generated by calls
> like
>
> (define (php s)
> (make-pi 'php 'php "php" s))
>
>
> (make-document
> (make-prolog
> (if phpscript (list phpscript) '())
> (make-document-type
> 'html
> (make-external-dtd/public "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
> "-//W3C//DTD XHTML 1.0 Strict//EN") #f))
>
> (xexpr->xml
> `(html ((xmlns "http://www.w3.org/1999/xhtml")
> (xml:lang "en") (lang "en-US"))
> (head ...
> (body ...
> (input ((type "text")
> (value ,(php "echo $var;")))
> '())
>
> I'd like the (input ...) element to have a php snippet as its value attribute,
> producing
>
> <input type="text" value="<?php echo $var;?>"/>
>
> I can't just pass this string as the value, because the "<" and ">" get translated
> to "<" and ">" by make-document. If I leave the pi struct as above, I get the
> error
>
> srep->attribute: expected (list Symbol String) given (value (php "echo $var;"))
>
> I also tried overriding xml.ss' xexpr->xml and srep->attribute procs locally to allow
> a non-string attribute value, without success.
>
> Wayne
> On Tue, Nov 21, 2006 at 08:05:25AM -0500, Jay McCarthy wrote:
> > On 11/21/06, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
> > >> <input type="text" value="<?=$var?>"/>
> > >
> > >`(input ([type "text"][value ,var]))
> >
> > or
> >
> > `(input ([type "text"][value ,(make-cdata #f #f "<?= $var ?>")]))
> >
> > Are you using scheme to genereate php?
> >
> > Jay
> >
> > --
> > Jay McCarthy <jay.mccarthy at gmail.com>
> > http://jay.teammccarthy.org
> >
>
--
Jay McCarthy <jay.mccarthy at gmail.com>
http://jay.teammccarthy.org