[racket] sxpath, txpath and accessors

From: Sanjeev K Sharma (throwit1 at gmail.com)
Date: Tue Mar 3 06:56:34 EST 2015

On Mon, Mar 02, 2015 at 09:52:53AM -0500, Vincent St-Amour wrote:
> I recommend the short tutorial near the top of this document:
>     http://pkg-build.racket-lang.org/doc/sxml/sxpath.html

Thanks for the suggested solution;

that was exactly the document I referred to 

I have not been able to generate an sxpath working example of the axes listed at the bottom of that page.  Aside from generating an example, from Oleg's documents to some other google hits I haven't found working examples either.

a simplified example (including your suggestion)

#lang racket (require sxml)(require sxml/html)
(define doc(html->xexp
      <www> www content <xxx/><www>
      <DDD> content in ccc 

;  '((ccc))

;  '((www "\n" "      " (zzz) "\n" "   ")
;    (www
;     " www content "
;     (xxx)
;     (www "\n" "      " (zzz) "\n" "   ")))
;  '()

((sxpath '(aaa xxx (sxml:preceding '(www)))) doc)
;  '()
((sxpath '(aaa xxx (sxml:preceding (www)))) doc)
;  '()

((sxpath'(aaa xxx (preceding:"www")))doc)
;  '()

((sxpath '(aaa xxx ((sxml::preceding "www")))) doc)
;  '()

((sxml:preceding ((sxpath '(aaa xxx www))))doc)
;  '()

Posted on the users mailing list.