|
Subject: Re: Processing fot From: Charlie & Barbara Bozeman <cbozeman@xxxxxxxxxx> Date: Tue, 23 Jun 1998 02:17:00 +0000 |
Daniel Speck wrote:
>
> Charlie Bozeman wrote:
>
> > Question: Is it possible to generate info from a document once and then
> > reference the info as you process the document?
> >
>
> In general, no, not using standard DSSSL which is side-effect free.
I was hoping there is some scheme trick that would work, my scheme
knowledge is weak.
>
> > When I process a flow-object-tree (from jade of course) I only want to
> > process the "a" elements that are referenced by "page-number" elements
> > (with the ref attribute) within the fot. Currently I do this by
> > selecting
> > all the "page-number" elements in the document and check if their "ref"
> > attribute matches my current "a" element. As you might imagine, this is
> > very time consuming.
>
> I'm not sure what you are trying to do. It would be helpful to see the DTD,
> a small sample instance and a description of the end result you are trying
> to achieve (I don't know what the <a> or the <page-number> elements
> represent). This sort of processing is often done using modes in DSSSL. If
> you are using ID/IDREF to link elements you can use a mode together with
> (process-element-with-id ...) to process a referenced element.
I am playing around with converting the flow-object-tree which jade
produces, to groff. In order to build a table-of-contents I need to
forward reference page numbers. My solution is to build an auxiliary
file with the page number of the "a" elements and input the file
in the main document. This is obviously a two-pass process and there
may be some better way of doing this, but my knowledge of 'roff is
worse than my knowledge of scheme.
The dtd (fot.dtd) comes with the jade source; here is a fragment of what
I am doing:
(define (check-page-number-ref name)
(let ((p-num (select-elements (descendants (sgml-root-element))
"page-number")))
(let loop ((nl p-num))
(if (node-list-empty? nl)
#f
(let* ((snl (node-list-first nl))
(ref (attribute-string "ref" snl))
(rest (node-list-rest nl)))
(if (equal? ref name)
#t
(loop rest)))))))
(element a
(let ((name (attribute-string (normalize "name"))))
(make sequence
(if (check-page-number-ref name)
(write-string-RE
(string-append ".sy echo .ds anch@" name " \\n%
>>groff.aux"))
(empty-sosofo)))))
(element page-number
(let ((ref (attribute-string (normalize "ref"))))
(make sequence
(if ref
(write-string (string-append "\\*[anch@" ref "]"))
(write-string "\\\\n%")))))
Charlie B.
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Processing fot, Daniel Speck | Thread | Re: Processing fot, Daniel Speck |
| Re: Processing fot, Charlie & Barbara Bo | Date | Re: Graphics in JadeTeX, Sebastian Rahtz |
| Month |