Use quai-quote and unquote to use variables within a list. <div><br></div><div>`((i . ,num)) </div><div><br></div><div>instead of </div><div><br></div><div>'((i . num)) </div><div><br></div><div>Cheers,</div><div>yc</div>
<div><br><br><div class="gmail_quote">On Wed, Sep 15, 2010 at 1:17 PM, michail bulgakov <span dir="ltr"><<a href="mailto:hofstadtertheman@gmail.com">hofstadtertheman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi!<br><br>I have almost no experience with scheme, but I started a project just to test and play with the language.<br>I use lizorkins sxml library(?) to parse some xml files. However I have som truble with the way it uses variables in sxpath.<br>
<br>This code works: <br><br>(define (get-title doc)<br> (srl:sxml->xml<br> ((sxpath "books/book[$i]/title/text()")<br> (sxml:document doc)<br> '[(i . 1)])))<br><br>But this dosen't:<br>
<br>(define (get-title doc num)<br> (srl:sxml->xml<br> ((sxpath ""books/book[$i]/title/text()")<br> (sxml:document doc)<br> '[(i . num)])))<br><br>When
I debug the code I can se that i changes to num after the evaluation of
the xpath query, but I'm not sure if I use the debugger correctly since
I've only playd with it today.<br>
What am I missing? I know that I jumped on a project thats maybe a bit
to hard for my level but I like to learn that way and it often works,
but this time I'm stuck.<br><br>Sorry for the bad english, it's not my native language and I seldom write in it.
<br>_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br></blockquote></div><br><br clear="all"><br>
</div>