Desperate Questions: [1]Absolute-Child-Number

Subject: Desperate Questions: [1]Absolute-Child-Number
From: "W. Eliot Kimber" <eliot@xxxxxxxxxx>
Date: Tue, 24 Jun 1997 12:02:39 -0500
All,

I am writing a transform to generate the HTML version of the HyTime
standard--time is short and thus I am desperate.  Normally I'd puzzle these
questions out myself, but I'm begging the indulgence of this august body
and taking the easy way out.

My first challenge is calculating the absolute child number of an element.
The standard DTD has 7 different element types that are the first level
divisions within standard (H1, scope, refs, defs, notation, annexn,
annexi).  In order to number things automatically I need the absolute child
numbers of these element types.  However, I can't for the life of me figure
out how to do it.  Here's my attempt at an absolute-child-number function:

(define (absolute-child-number %element%)
  (- (node-list-length (children (parent %element%)))
     (length (member (node-list->list %element%) (node-list->list (children
(parent %element%)))))))

Unfortunately, this doesn't work, as member returns #f and there doesn't
appear to be a node-list equivalent of member (and I'm not up to deriving
it on my own).

So: how do I calculate the absolute child number of an element with Jade?

[NOTE: James solved this by hard-coding the numbering function for the
non-H1 element types in the DSSSL spec's DSSSL spec.  I'd prefer not to
have to resort to that, as this is something I often need to do because of
the nature of the document types I write.]

Thanks,

Eliot

 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread