;; Validation tests for DDO SXPath: "ddo-axes.scm" + "ddo-xpath.scm" ; ; Please send bug reports and comments to: ; lisovsky@acm.org Kirill Lisovsky ; lizorkin@hotbox.ru Dmitry Lizorkin ; We define a document (define vddo:old-doc '(*TOP* (*PI* xml "version='1.0'") (doc (multidirectional (@ (http://www.w3.org/1999/xlink:type "extended")) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest")))) (item (@ (id "toc1")) "chapter1") (item (@ (id "toc2")) "chapter2") (item (@ (id "toc3")) "chapter3") (item (@ (id "toc4")) "chapter4") (item (@ (id "toc5")) "chapter5") (item (@ (id "toc6")) "chapter6") (item (@ (id "toc7")) "chapter7") (body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))))))) ; Function for attaching id-index to document ; DL: local version of the function - prefixed with `vddo:' (define (vddo:SXML->SXML+id document id-attrs) (let ((aux-subtrees (let ((aux ((select-kids (ntype?? '@@)) document))) (if (null? aux) '() (let rpt ((res '()) (to-see (cdar aux))) (cond ((null? to-see) (reverse res)) ((equal? (caar to-see) 'id-index) (rpt res (cdr to-see))) (else (rpt (cons (car to-see) res) (cdr to-see))))))))) (let loop ((nodeset (list document)) (id-index '())) (if (null? nodeset) (let ((kids ((select-kids (lambda (node) (not (and (pair? node) (equal? (car node) '@@))))) document))) (cons '*TOP* (cons (cons '@@ (cons (cons 'id-index id-index) aux-subtrees)) kids))) (let ((cur-node (car nodeset))) (cond ((not (pair? cur-node)) (loop (cdr nodeset) id-index)) ((assoc (car cur-node) id-attrs) => (lambda (lst) (let ((id-values ((select-kids (lambda (x) #t)) ((sxml:filter (lambda (x) (member (car x) (cdr lst)))) ((select-kids (lambda (x) #t)) ((select-kids (ntype?? '@)) cur-node)))))) (loop (append ((select-kids (ntype?? '*)) (car nodeset)) (cdr nodeset)) (append id-index (map (lambda (x) (cons x cur-node)) id-values)))))) (else (loop (append ((select-kids (ntype?? '*)) (car nodeset)) (cdr nodeset)) id-index)))))))) ; Document with id-index added (define vddo:doc (vddo:SXML->SXML+id vddo:old-doc '((item id) (chapter id) (section ID) (appendix id)))) ; Namespace binding (define vddo:ns-binding (list (cons 'xlink "http://www.w3.org/1999/xlink"))) ; (lambda (x) x) (xtest-assert ; Expected result: '(*TOP* (@@ (id-index ("toc1" item (@ (id "toc1")) "chapter1") ("toc2" item (@ (id "toc2")) "chapter2") ("toc3" item (@ (id "toc3")) "chapter3") ("toc4" item (@ (id "toc4")) "chapter4") ("toc5" item (@ (id "toc5")) "chapter5") ("toc6" item (@ (id "toc6")) "chapter6") ("toc7" item (@ (id "toc7")) "chapter7") ("chap1" chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) ("chap2" chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) ("sec2-1" section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0.")) ("chap3" chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) ("chap4" chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) ("chap5" chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) ("chap6" chapter (@ (id "chap6")) (title "samples")) ("chap7" chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) ("here" appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))))) (*PI* xml "version='1.0'") (doc (multidirectional (@ (http://www.w3.org/1999/xlink:type "extended")) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest")))) (item (@ (id "toc1")) "chapter1") (item (@ (id "toc2")) "chapter2") (item (@ (id "toc3")) "chapter3") (item (@ (id "toc4")) "chapter4") (item (@ (id "toc5")) "chapter5") (item (@ (id "toc6")) "chapter6") (item (@ (id "toc7")) "chapter7") (body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))))))) ; <--- of: (lambda (x) x) vddo:doc ) ;========================================================================= ; Location Path testing ; sxml:xpath (xtest-assert ; Expected result: '("Text node") ; <--- of: (ddo:txpath ".") '("Text node") ) ;------------------------------------------------ ; Equal results for all these calls ; (ddo:txpath child::*/child::*[2]) (xtest-assert ; Expected result: '((item (@ (id "toc1")) "chapter1")) ; <--- of: (ddo:txpath "child::*/child::*[2]") vddo:doc ) ; (ddo:txpath */*[2]) (xtest-assert ; Expected result: '((item (@ (id "toc1")) "chapter1")) ; <--- of: (ddo:txpath "*/*[2]") vddo:doc ) ; (ddo:txpath /*/*[2]) (xtest-assert ; Expected result: '((item (@ (id "toc1")) "chapter1")) ; <--- of: (ddo:txpath "/*/*[2]") vddo:doc ) ; (ddo:txpath descendant-or-self::node()[attribute::id ='toc1']) (xtest-assert ; Expected result: '((item (@ (id "toc1")) "chapter1")) ; <--- of: (ddo:txpath "descendant-or-self::node()[attribute::id ='toc1']") vddo:doc ) ; (ddo:txpath //*[attribute::* ='toc1']) (xtest-assert ; Expected result: '((item (@ (id "toc1")) "chapter1")) ; <--- of: (ddo:txpath "//*[attribute::* ='toc1']") vddo:doc ) ; (ddo:txpath //node()[attribute::id][1]) (xtest-assert ; Expected result: '((item (@ (id "toc1")) "chapter1") (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine..."))) ; <--- of: (ddo:txpath "//node()[attribute::id][1]") vddo:doc ) ; (ddo:txpath //*[ self::node() = id('toc1') ]) (xtest-assert ; Expected result: '((item (@ (id "toc1")) "chapter1")) ; <--- of: (ddo:txpath "//*[ self::node() = id('toc1') ]") vddo:doc ) ;------------------------------------------------ ; Node tests ; (ddo:txpath descendant::processing-instruction()) (xtest-assert ; Expected result: '((*PI* xml "version='1.0'")) ; <--- of: (ddo:txpath "descendant::processing-instruction()") vddo:doc ) ; (ddo:txpath descendant::processing-instruction( 'xml' )) (xtest-assert ; Expected result: '((*PI* xml "version='1.0'")) ; <--- of: (ddo:txpath "descendant::processing-instruction( 'xml' )") vddo:doc ) ; (ddo:txpath descendant::processing-instruction( 'smth else' )) (xtest-assert ; Expected result: '() ; <--- of: (ddo:txpath "descendant::processing-instruction( 'smth else' )") vddo:doc ) ; (ddo:txpath //*[ self::processing-instruction('smth else') ]) (xtest-assert ; Expected result: '() ; <--- of: (ddo:txpath "//*[ self::processing-instruction('smth else') ]") vddo:doc ) ; (ddo:txpath descendant-or-self::text()) (xtest-assert ; Expected result: '("chapter1" "chapter2" "chapter3" "chapter4" "chapter5" "chapter6" "chapter7" "Abstract" "This document describes about XLink Engine..." "Introduction" "This document is written in XML (eXtensible Markup Language) ver.1.0." "What is XLink?" "hyperlink" "What is XPointer?" "XPointer is the fragment identifier of documents having the mime-type hogehoge." "Models for using XLink/XPointer " "There are important keywords." "samples" "Conclusion" "Thanks a lot." "Who1" "XML Linking Language (XLink)" "foo.com" "Who2" "XML Pointing Language (XPointer)" "boo.com") ; <--- of: (ddo:txpath "descendant-or-self::text()") vddo:doc ) ; (ddo:txpath descendant-or-self::text()[ self::node() = 'boo.com' ]) (xtest-assert ; Expected result: '("boo.com") ; <--- of: (ddo:txpath "descendant-or-self::text()[ self::node() = 'boo.com' ]") vddo:doc ) ; (ddo:txpath */*/text()) (xtest-assert ; Expected result: '("chapter1" "chapter2" "chapter3" "chapter4" "chapter5" "chapter6" "chapter7") ; <--- of: (ddo:txpath "*/*/text()") vddo:doc ) ; (ddo:txpath //attribute::xlink:type ns-binding) (xtest-assert ; Expected result: '((http://www.w3.org/1999/xlink:type "extended") (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:type "arc")) ; <--- of: (ddo:txpath "//attribute::xlink:type" vddo:ns-binding) vddo:doc ) ; (ddo:txpath //attribute::xlink:*[ self::* = 'hoge' ] ns-binding) (xtest-assert ; Expected result: '((http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:from "hoge")) ; <--- of: (ddo:txpath "//attribute::xlink:*[ self::* = 'hoge' ]" vddo:ns-binding) vddo:doc ) ; (ddo:txpath //attribute::xlink:* (quote ((xlink . http://www.else.com)))) (xtest-assert ; Expected result: '() ; <--- of: (ddo:txpath "//attribute::xlink:*" '((xlink . "http://www.else.com"))) vddo:doc ) ;------------------------------------------------ ; Axes ; (ddo:txpath *[1]/*[9]/*[3]/@*) (xtest-assert ; Expected result: '((id "chap3")) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/@*") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id) (xtest-assert ; Expected result: '((id "toc3")) ; <--- of: (ddo:txpath "*[1]/*[4]/@id") vddo:doc ) ; (ddo:txpath *[1]/*[9]/*[3]/.) (xtest-assert ; Expected result: '((chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink"))) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/.") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id/.) (xtest-assert ; Expected result: '((id "toc3")) ; <--- of: (ddo:txpath "*[1]/*[4]/@id/.") vddo:doc ) ; (ddo:txpath *[1]/*[9]/*[3]/..) (xtest-assert ; Expected result: '((body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))))) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/..") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id/..) (xtest-assert ; Expected result: '((item (@ (id "toc3")) "chapter3")) ; <--- of: (ddo:txpath "*[1]/*[4]/@id/..") vddo:doc ) ; (ddo:txpath *[1]/*[9]/*[3]/following-sibling::*) (xtest-assert ; Expected result: '((chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))))) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/following-sibling::*") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id/following-sibling::*) (xtest-assert ; Expected result: '() ; <--- of: (ddo:txpath "*[1]/*[4]/@id/following-sibling::*") vddo:doc ) ; (ddo:txpath *[1]/*[9]/*[3]/preceding-sibling::*) (xtest-assert ; Expected result: '((chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0.")))) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/preceding-sibling::*") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id/preceding-sibling::*) (xtest-assert ; Expected result: '() ; <--- of: (ddo:txpath "*[1]/*[4]/@id/preceding-sibling::*") vddo:doc ) ; (ddo:txpath *[1]/*[9]/*[3]/following::*) (xtest-assert ; Expected result: '((chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.") (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (title "Models for using XLink/XPointer ") (p "There are important keywords.") (chapter (@ (id "chap6")) (title "samples")) (title "samples") (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (title "Conclusion") (p "Thanks a lot.") (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))) (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com") (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")) (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/following::*") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id/following::node()) (xtest-assert ; Expected result: '("chapter3" (item (@ (id "toc4")) "chapter4") "chapter4" (item (@ (id "toc5")) "chapter5") "chapter5" (item (@ (id "toc6")) "chapter6") "chapter6" (item (@ (id "toc7")) "chapter7") "chapter7" (body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))))) (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (title "Abstract") "Abstract" (p "This document describes about XLink Engine...") "This document describes about XLink Engine..." (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (title "Introduction") "Introduction" (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0.")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0.") "This document is written in XML (eXtensible Markup Language) ver.1.0." (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (title "What is XLink?") "What is XLink?" (p "hyperlink") "hyperlink" (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (title "What is XPointer?") "What is XPointer?" (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.") "XPointer is the fragment identifier of documents having the mime-type hogehoge." (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (title "Models for using XLink/XPointer ") "Models for using XLink/XPointer " (p "There are important keywords.") "There are important keywords." (chapter (@ (id "chap6")) (title "samples")) (title "samples") "samples" (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (title "Conclusion") "Conclusion" (p "Thanks a lot.") "Thanks a lot." (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))) (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (author "Who1") "Who1" (title "XML Linking Language (XLink)") "XML Linking Language (XLink)" (ref "foo.com") "foo.com" (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")) (author "Who2") "Who2" (title "XML Pointing Language (XPointer)") "XML Pointing Language (XPointer)" (ref "boo.com") "boo.com") ; <--- of: (ddo:txpath "*[1]/*[4]/@id/following::node()") vddo:doc ) ; (ddo:txpath *[1]/*[9]/*[3]/preceding::*) (xtest-assert ; Expected result: '((multidirectional (@ (http://www.w3.org/1999/xlink:type "extended")) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest")))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (item (@ (id "toc1")) "chapter1") (item (@ (id "toc2")) "chapter2") (item (@ (id "toc3")) "chapter3") (item (@ (id "toc4")) "chapter4") (item (@ (id "toc5")) "chapter5") (item (@ (id "toc6")) "chapter6") (item (@ (id "toc7")) "chapter7") (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (title "Abstract") (p "This document describes about XLink Engine...") (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0.")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0.")) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/preceding::*") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id/preceding::*) (xtest-assert ; Expected result: '((multidirectional (@ (http://www.w3.org/1999/xlink:type "extended")) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest")))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (item (@ (id "toc1")) "chapter1") (item (@ (id "toc2")) "chapter2")) ; <--- of: (ddo:txpath "*[1]/*[4]/@id/preceding::*") vddo:doc ) ; (ddo:txpath *[1]/*[9]/*[3]/parent::*) (xtest-assert ; Expected result: '((body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))))) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/parent::*") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id/parent::*) (xtest-assert ; Expected result: '((item (@ (id "toc3")) "chapter3")) ; <--- of: (ddo:txpath "*[1]/*[4]/@id/parent::*") vddo:doc ) ; (ddo:txpath *[1]/*[9]/*[3]/ancestor::*) (xtest-assert ; Expected result: `(,vddo:doc ; document node (doc (multidirectional (@ (http://www.w3.org/1999/xlink:type "extended")) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest")))) (item (@ (id "toc1")) "chapter1") (item (@ (id "toc2")) "chapter2") (item (@ (id "toc3")) "chapter3") (item (@ (id "toc4")) "chapter4") (item (@ (id "toc5")) "chapter5") (item (@ (id "toc6")) "chapter6") (item (@ (id "toc7")) "chapter7") (body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))))) (body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))))) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/ancestor::*") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id/ancestor::*) (xtest-assert ; Expected result: `(,vddo:doc ; document node (doc (multidirectional (@ (http://www.w3.org/1999/xlink:type "extended")) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest")))) (item (@ (id "toc1")) "chapter1") (item (@ (id "toc2")) "chapter2") (item (@ (id "toc3")) "chapter3") (item (@ (id "toc4")) "chapter4") (item (@ (id "toc5")) "chapter5") (item (@ (id "toc6")) "chapter6") (item (@ (id "toc7")) "chapter7") (body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))))) (item (@ (id "toc3")) "chapter3")) ; <--- of: (ddo:txpath "*[1]/*[4]/@id/ancestor::*") vddo:doc ) ; (ddo:txpath *[1]/*[9]/*[3]/ancestor-or-self::*) (xtest-assert ; Expected result: `(,vddo:doc ; document node (doc (multidirectional (@ (http://www.w3.org/1999/xlink:type "extended")) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest")))) (item (@ (id "toc1")) "chapter1") (item (@ (id "toc2")) "chapter2") (item (@ (id "toc3")) "chapter3") (item (@ (id "toc4")) "chapter4") (item (@ (id "toc5")) "chapter5") (item (@ (id "toc6")) "chapter6") (item (@ (id "toc7")) "chapter7") (body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))))) (body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink"))) ; <--- of: (ddo:txpath "*[1]/*[9]/*[3]/ancestor-or-self::*") vddo:doc ) ; (ddo:txpath *[1]/*[4]/@id/ancestor-or-self::*) (xtest-assert ; Expected result: `(,vddo:doc ; document node (doc (multidirectional (@ (http://www.w3.org/1999/xlink:type "extended")) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 toc") (http://www.w3.org/1999/xlink:role "booboo") (http://www.w3.org/1999/xlink:label "boo") (http://www.w3.org/1999/xlink:href "#toc1"))) (loc (@ (http://www.w3.org/1999/xlink:type "locator") (http://www.w3.org/1999/xlink:title "Chap.1 cont") (http://www.w3.org/1999/xlink:role "text/xml") (http://www.w3.org/1999/xlink:label "hoge") (http://www.w3.org/1999/xlink:href "#chap1"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "hoge") (http://www.w3.org/1999/xlink:title "Traversal to content page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "boo") (http://www.w3.org/1999/xlink:actuate "onRequest"))) (arc (@ (http://www.w3.org/1999/xlink:type "arc") (http://www.w3.org/1999/xlink:to "boo") (http://www.w3.org/1999/xlink:title "Traversal to toc page") (http://www.w3.org/1999/xlink:show "replace") (http://www.w3.org/1999/xlink:from "hoge") (http://www.w3.org/1999/xlink:actuate "onRequest")))) (item (@ (id "toc1")) "chapter1") (item (@ (id "toc2")) "chapter2") (item (@ (id "toc3")) "chapter3") (item (@ (id "toc4")) "chapter4") (item (@ (id "toc5")) "chapter5") (item (@ (id "toc6")) "chapter6") (item (@ (id "toc7")) "chapter7") (body (chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com")))))) (item (@ (id "toc3")) "chapter3") (id "toc3")) ; <--- of: (ddo:txpath "*[1]/*[4]/@id/ancestor-or-self::*") vddo:doc ) ;------------------------------------------------ ; position() and last() functions ; (ddo:txpath */*[position()=2]) (xtest-assert ; Expected result: '((item (@ (id "toc1")) "chapter1")) ; <--- of: (ddo:txpath "*/*[position()=2]") vddo:doc ) ; (ddo:txpath */*[position()=last()-4]) (xtest-assert ; Expected result: '((item (@ (id "toc4")) "chapter4")) ; <--- of: (ddo:txpath "*/*[position()=last()-4]") vddo:doc ) ; (ddo:txpath */*[position()>=4 and position()=4 and position()4 and not( false() ) and ('err'= 12 or true() ) ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " 7>4 and not( false() ) and ('err'= 12 or true() ) ") '() ) ; (ddo:xpath-expr true() > false() ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " true() > false() ") '() ) ; (ddo:xpath-expr ' 15 ' = 15 = true()) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " ' 15 ' = 15 = true()") '() ) ;------------------------------------------------ ; Variable reference ; (ddo:xpath-expr $xlink and true() ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " $xlink and true() ") '() '((xlink . #t)) ) ; (ddo:xpath-expr $x - 4) (xtest-assert ; Expected result: '41 ; <--- of: (ddo:xpath-expr " $x - 4") '() '((x . 45)) ) ; (ddo:xpath-expr $y ) (xtest-assert ; Expected result: '"variable value" ; <--- of: (ddo:xpath-expr " $y ") '() '((y . "variable value")) ) ;------------------------------------------------ ; Datatype convertion ; (ddo:xpath-expr number(' -34 ') ) (xtest-assert ; Expected result: '-34 ; <--- of: (ddo:xpath-expr " number(' -34 ') ") '() ) ; (ddo:xpath-expr number(' -34.67 ') ) (xtest-assert ; Expected result: '-34.67 ; <--- of: (ddo:xpath-expr " number(' -34.67 ') ") '() ) ; (ddo:xpath-expr number( true() ) ) (xtest-assert ; Expected result: '1 ; <--- of: (ddo:xpath-expr " number( true() ) ") '() ) ; (ddo:xpath-expr number(false()) ) (xtest-assert ; Expected result: '0 ; <--- of: (ddo:xpath-expr " number(false()) ") '() ) ; (ddo:xpath-expr boolean( -56 ) ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " boolean( -56 ) ") '() ) ; (ddo:xpath-expr boolean( 0 ) ) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr " boolean( 0 ) ") '() ) ; (ddo:xpath-expr boolean( 'ere' ) ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " boolean( 'ere' ) ") '() ) ; (ddo:xpath-expr boolean( '' ) ) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr " boolean( '' ) ") '() ) ; (ddo:xpath-expr string( 0 ) ) (xtest-assert ; Expected result: '"0" ; <--- of: (ddo:xpath-expr " string( 0 ) ") '() ) ; (ddo:xpath-expr string( -76 ) ) (xtest-assert ; Expected result: '"-76" ; <--- of: (ddo:xpath-expr " string( -76 ) ") '() ) ; (ddo:xpath-expr string( true() ) ) (xtest-assert ; Expected result: '"true" ; <--- of: (ddo:xpath-expr " string( true() ) ") '() ) ; (ddo:xpath-expr string( false() ) ) (xtest-assert ; Expected result: '"false" ; <--- of: (ddo:xpath-expr " string( false() ) ") '() ) ;------------------------------------------------ ; Comparison operations (for simple datatypes) ; (ddo:xpath-expr false() = 12 ) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr " false() = 12 ") '() ) ; (ddo:xpath-expr true() = 12 ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " true() = 12 ") '() ) ; (ddo:xpath-expr true() != 0) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr "true() != 0") '() ) ; (ddo:xpath-expr false() = '' ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " false() = '' ") '() ) ; (ddo:xpath-expr false() = 'smth' ) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr " false() = 'smth' ") '() ) ; (ddo:xpath-expr true() != 'smth' ) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr " true() != 'smth' ") '() ) ; (ddo:xpath-expr '12 ' = 12 ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " '12 ' = 12 ") '() ) ; (ddo:xpath-expr '123 ' != 12 ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " '123 ' != 12 ") '() ) ; (ddo:xpath-expr true() > 0 ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " true() > 0 ") '() ) ; (ddo:xpath-expr ( false() < 1 )) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr "( false() < 1 )") '() ) ; (ddo:xpath-expr ' 12' <= 1 ) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr " ' 12' <= 1 ") '() ) ; (ddo:xpath-expr ( ' 12' >= ' -2 ' )) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr "( ' 12' >= ' -2 ' )") '() ) ; (ddo:xpath-expr 'ee' <= 1 ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " 'ee' <= 1 ") '() ) ; (ddo:xpath-expr ( 'aaa' < 'bbb' )) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr "( 'aaa' < 'bbb' )") '() ) ;------------------------------------------------ ; Union operation ; (ddo:xpath-expr *[1]/*[7] | *[1]/*[9]/*[2] ) (xtest-assert ; Expected result: '((item (@ (id "toc6")) "chapter6") (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0.")))) ; <--- of: (ddo:xpath-expr "*[1]/*[7] | *[1]/*[9]/*[2] ") vddo:doc ) ; (ddo:xpath-expr id('toc2') | id('chap4') | id('here') ) (xtest-assert ; Expected result: '((item (@ (id "toc2")) "chapter2") (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))))) ; <--- of: (ddo:xpath-expr " id('toc2') | id('chap4') | id('here') ") vddo:doc ) ;------------------------------------------------ ; Nodeset comparison ; (ddo:xpath-expr */*[9]/*[5]/following::node() = 'ConclusionThanks a lot.') (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " */*[9]/*[5]/following::node() = 'ConclusionThanks a lot.'") vddo:doc ) ; (ddo:xpath-expr */*[9]/*[5]/following::node() = //appendix//item[1] ) (xtest-assert ; Expected result: '#t ; <--- of: (ddo:xpath-expr " */*[9]/*[5]/following::node() = //appendix//item[1] ") vddo:doc ) ; (ddo:xpath-expr */*[9]/*[5]/following::node() = */*[9]/*[6]/preceding-sibling::node() ) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr " */*[9]/*[5]/following::node() = */*[9]/*[6]/preceding-sibling::node() ") vddo:doc ) ; (ddo:xpath-expr (//text()[23] | //text()[24]) = ( //*[self::node() = 'foo.com'] | *[1]/*[1] ) ) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr " (//text()[23] | //text()[24]) = ( //*[self::node() = 'foo.com'] | *[1]/*[1] ) ") vddo:doc ) ; (ddo:xpath-expr //xlink:label[self::* = 'hoge'] > id( 'chap6' ) ns-binding) (xtest-assert ; Expected result: '#f ; <--- of: (ddo:xpath-expr " //xlink:label[self::* = 'hoge'] > id( 'chap6' ) " vddo:ns-binding) vddo:doc ) ;------------------------------------------------ ; Filter expression with position predicate ; (ddo:xpath-expr (doc/body/*)[position()]) (xtest-assert ; Expected result: '((chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))))) ; <--- of: (ddo:xpath-expr "(doc/body/*)[position()]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[position()=4]) (xtest-assert ; Expected result: '(chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) ; <--- of: (ddo:xpath-expr "(doc/body/*)[position()=4]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[4]) (xtest-assert ; Expected result: '(chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) ; <--- of: (ddo:xpath-expr "(doc/body/*)[4]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[4=position()]) (xtest-assert ; Expected result: '(chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) ; <--- of: (ddo:xpath-expr "(doc/body/*)[4=position()]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[last()]) (xtest-assert ; Expected result: '((appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))))) ; <--- of: (ddo:xpath-expr "(doc/body/*)[last()]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[position()<=6]) (xtest-assert ; Expected result: '((chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords.")) (chapter (@ (id "chap6")) (title "samples"))) ; <--- of: (ddo:xpath-expr "(doc/body/*)[position()<=6]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[position()<6]) (xtest-assert ; Expected result: '((chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink")) (chapter (@ (id "chap4")) (title "What is XPointer?") (p "XPointer is the fragment identifier of documents having the mime-type hogehoge.")) (chapter (@ (id "chap5")) (title "Models for using XLink/XPointer ") (p "There are important keywords."))) ; <--- of: (ddo:xpath-expr "(doc/body/*)[position()<6]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[position()>=6]) (xtest-assert ; Expected result: '((chapter (@ (id "chap6")) (title "samples")) (chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))))) ; <--- of: (ddo:xpath-expr "(doc/body/*)[position()>=6]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[position()>6]) (xtest-assert ; Expected result: '((chapter (@ (id "chap7")) (title "Conclusion") (p "Thanks a lot.")) (appendix (@ (id "here")) (bibliographic (item (author "Who1") (title "XML Linking Language (XLink)") (ref "foo.com")) (item (author "Who2") (title "XML Pointing Language (XPointer)") (ref "boo.com"))))) ; <--- of: (ddo:xpath-expr "(doc/body/*)[position()>6]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[3>position()]) (xtest-assert ; Expected result: '((chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0.")))) ; <--- of: (ddo:xpath-expr "(doc/body/*)[3>position()]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[3>=position()]) (xtest-assert ; Expected result: '((chapter (@ (id "chap1")) (title "Abstract") (p "This document describes about XLink Engine...")) (chapter (@ (id "chap2")) (title "Introduction") (section (@ (ID "sec2-1")) (p "This document is written in XML (eXtensible Markup Language) ver.1.0."))) (chapter (@ (id "chap3")) (title "What is XLink?") (p "hyperlink"))) ; <--- of: (ddo:xpath-expr "(doc/body/*)[3>=position()]") vddo:doc ) ; (ddo:xpath-expr (doc/body/*)[3