Subject: Re: TOC From: Graydon Hoare <graydon@xxxxxxxxxxxxx> Date: Fri, 5 Jun 1998 12:27:58 -0400 (EDT) |
> Specifically, I have an SGML document with the following (partial) structure > > <RPC> > <INTRO> > <BODY> > <PCAT> > <POS> > ... > > Element POS has an attribute list with one attribute and about 10 possible > values for the attribute. I'd like the table of contents to reference and > link to each occurence of the attribute values as they appear within the > document. > > Any help - especially examples - would be greatly appreciated. This should do something like what you are looking for.. note: you'll have to replace the variables ending in "*" with your attribute name and attribute values, and I'm assuming your POS elements have unique ID attributes. If they don't, it's a small task to add them (let me know and I can give you a little script that'll do it) You'll also need a properly defined map-constructor as outlined in the DSSSL spec. ;; generate the TOC from, I guess, the "RPC" level.. (element rpc (let* ( (nodelist-list (map (lambda (attvalue) (select-elements (descendants (current-node)) (list 'pos (list 'attname* attvalue)))) '(attval1* attval2* attval3* attval4* attval5*))) (hyperlink-maker (lambda (node-to-link-to) (make sequence (make element gi: "a" attributes: (list (list "href" (string-append "#" (id node-to-link-to)))) (attribute-string "attname*" node-to-link-to)) (make empty-element gi: "br")))) (nodelist-to-hyperlink-list (lambda (nl) (map-constructor hyperlink-maker nl)))) (make-sequence (map nodelist-to-hyperlink-list nodelist-list)))) ;; now generate the targets (element pos (make element gi: "a" attributes: (list (list "name" (id (current-node)))) (process-children))) -graydon <graydon@xxxxxxxxxxxxx> DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: TOC, G. Ken Holman | Thread | DSSSL and converting to RTF for Wor, Dan Hable |
DSSSL and converting to RTF for Wor, Dan Hable | Date | Re: DSSSL and converting to RTF for, Norman Walsh |
Month |