aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/sxml/namespaced-xpath.scm
blob: e625d5146d89aa749fab17b785d30ddee5bd2dfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(define-module (test sxml namespaced-xpath)
  :use-module (srfi srfi-64)
  :use-module (srfi srfi-64 test-error)
  :use-module (srfi srfi-88)
  :use-module ((sxml xpath) :prefix #{x:}#)
  :use-module (sxml namespaced)
  :use-module (sxml namespaced util))

(define html '(html (body (a (@ (href "#") (alt "Test")) "Hello")
                          (a (@ (href "/")) "World"))))

(define xmlns:html 'http://www.w3.org/1999/xhtml)

(define xhtml
  ((xml xmlns:html 'html)
   ((xml xmlns:html 'body)
    ((xml xmlns:html 'a `((href "#") (alt "Test"))) "Hello")
    ((xml xmlns:html 'a `((href "/"))) "World")
    ))
  )

(test-equal
    (list '(a (@ (href "#") (alt "Test")) "Hello"))
  ((x:sxpath '(// (a ((@ ((href ((equal? "#")))))))))
   html))


'()