; selects the fifth 'para' child of the context node if that child has a ; 'type' attribute with value 'warning' ; ; Abbreviated XPath: para[5][@type='warning'] ; Full XPath: child::para[position()=5][attribute::type='warning'] (define tree '(chapter (para "para1") (para (@ (type "warning")) "para 2") (para (@ (type "warning")) "para 3") (para (@ (type "warning")) "para 4") (para (@ (type "warning")) "para 5") (para (@ (type "warning")) "para 6")) ) ; Low-level: ((node-reduce (select-kids (ntype?? 'para)) (node-pos 5) (sxml:filter (node-join (select-kids (ntype?? '@)) (select-kids (node-equal? '(type "warning")))))) tree) ; SXPath: ((sxpath `( (( (para 5)) (@ (equal? (type "warning")))))) tree) ; SXPath: ((sxpath `( (para 5 (@ (equal? (type "warning")))) )) tree) ==> ((para (@ (type "warning")) "para 5"))