[racket] sxpath, txpath

From: Sanjeev Sharma (throwit1 at gmail.com)
Date: Mon Feb 23 05:58:39 EST 2015

I'm somehow stuck on how to translate txpath syntax to sxpath syntax

#lang racket (require sxml)(require sxml/html)
(define doc(html->xexp"<AAA>
   <BBB>
      <CCC/>
      <ZZZ/>
   </BBB>
   <XXX>
      <DDD>
           <EEE/>
           <FFF>
              <HHH/>
              <GGG>
                 <JJJ>
                    <QQQ/>
                 </JJJ>
                 <JJJ/>
              </GGG>
              <HHH/>
           </FFF>
      </DDD>
   </XXX>
   <CCC>abcdefg
      <DDD/>
   </CCC>
</AAA>"))

((txpath"/aaa/xxx/preceding::*")doc); expect bbb, ccc, zzz
((sxpath'(//ccc/descendant-or-self::*))doc)

I tried a bunch of variations  for sxpath:

((sxpath'(// ccc '(descendant-or-self )))doc)
((sxpath'(// ccc '(/ descendant-or-self )))doc)
((sxpath'(// ccc / descendant-or-self::*))doc)

~/.racket/6.1.1/pkgs/sxml/sxml/doc/sxml/sxpath.html
"Like sxpath, but only accepts an XPath query in string form, using the
standard XPath syntax.

Deprecated; use sxpath instead."

I'd like to get the other axes and accessors working but now that I've
spent some time on this I REALLY want to know what my blind spot is here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150223/1bd09695/attachment.html>

Posted on the users mailing list.