[plt-scheme] sxml.ss - Works on its own, but not in module

From: John Clements (clements at brinckerhoff.org)
Date: Sun Jan 13 17:41:59 EST 2008

On Jan 12, 2008, at 8:20 PM, Eric Biunno wrote:

> Hi, I'm a little confused. The following code works as expected:
>
> (require (planet "sxml.ss" ("lizorkin" "sxml.plt" 1 4)))
>
>   (define test
>     (apply
>  string-append
>  (sxml:clean-feed
>    (stx:transform-dynamic
>      (sxml:add-parents
>       (sxml:document "http://modis.ispras.ru/Lizorkin/XML/poem.xml"))
>      (stx:make-stx-stylesheet
>        (sxml:document
>          "http://modis.ispras.ru/Lizorkin/XML/poem2html.xsl"
>          '((xsl . " http://www.w3.org/1999/XSL/Transform")))))))
>    )
>
> (test)
>
> But when I create a module with this code and then call (test) from  
> another file I get the following error:
> .plt-scheme/planet/300/371/cache/lizorkin/sxml.plt/1/4/stx-  
> engine.ss::12970: reference to undefined identifier: sxpath

Something's not right, here.

1) The code you've supplied will not evaluate in the MzScheme  
language, because 'test' is bound to a string, and not to a procedure.
2) When I remove the parens around 'test', this code works fine and  
displays the expected string.
3) When I wrap it in a module and evaluate it, 'test' is again bound  
to the correct value.
4) When I require this module from another one and fetch the value of  
'test', I again get the right value.

Here's the module that I generated:

(module foo mzscheme
   (require (planet "sxml.ss" ("lizorkin" "sxml.plt" 1 4)))

(define test
   (apply
    string-append
    (sxml:clean-feed
     (stx:transform-dynamic
      (sxml:add-parents
       (sxml:document "http://modis.ispras.ru/Lizorkin/XML/poem.xml"))
      (stx:make-stx-stylesheet
       (sxml:document
        "http://modis.ispras.ru/Lizorkin/XML/poem2html.xsl"
        '((xsl . " http://www.w3.org/1999/XSL/Transform")))))))
   )

(provide test))


(module foo-user mzscheme
   (require (file "foo.ss"))

   (display test)
   )

John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2223 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20080113/687b7878/attachment.p7s>

Posted on the users mailing list.