| The Modular DocBook Stylesheets | ||
|---|---|---|
| Prev | DSSSL Library | Next |
(component-child-number inputnd #!optional (complist component-element-list))
Finds the first ancestor of inputnd in complist and then counts all the elements of type inputnd from that point on and returns the number of inputnd. (This is like a recursive-child-number starting at the first parent of inputnd in complist.)
Norman Walsh, <norm@berkshire.net>
(define (component-child-number inputnd #!optional (complist component-element-list))
;; Find child-number within a component
(let ((nd (ancestor-member inputnd complist)))
(let loop ((nl (select-elements (descendants nd) (gi inputnd)))
(num 1))
(if (node-list-empty? nl)
0
(if (node-list=? (node-list-first nl) inputnd)
num
(if (string=? (gi (node-list-first nl)) (gi inputnd))
(loop (node-list-rest nl) (+ num 1))
(loop (node-list-rest nl) num)))))))| Prev | Home | Next |
| case-fold-up | Up | constant-list |
Copyright © 1997, 1998 Norman Walsh