[plt-scheme] using pi structs in xml.ss

From: wayne at taxupdate.com (wayne at taxupdate.com)
Date: Tue Nov 21 04:10:13 EST 2006

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

(define (php s)
  (make-pi 'php 'php "php" s))
    (if phpscript (list phpscript) '())
     (make-external-dtd/public "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
                               "-//W3C//DTD XHTML 1.0 Strict//EN") #f))
    `(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,

<input type="text" value="<?php echo $var;?>"/>

I can't just pass this string as the value, because the "<" and ">" get translated
to "&lt;" and "&gt;" by make-document.  If I leave the pi struct as above, I get the

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.

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

Posted on the users mailing list.