Q: Jade, RTF, line breaks etc.

Subject: Q: Jade, RTF, line breaks etc.
From: Mikko Lounela <Mikko.Lounela@xxxxxx>
Date: Fri, 8 Aug 1997 15:35:01 +0300 (EET DST)
Newbie question:

I have started to (try and) write a DSSSL-spec for an adjusted
ISO/IEC10179:1996(E) book.dtd, and I have had pretty hard times with it.
I am using Jade with RTF backend in Win95 and viewing the results with MSWord.

Now it seems like the learning curve has stopped altogether.

The base of the problem is that I would need to have the information in the
AFF element from the structure below to appear in a different place in the
RTF file than it does in the SGML document:

<front>

 <authgrp>

  <author>
   <fname>First
   <surname>Authorf
   <role>Author
   <aff>
     <orgname>Org1
     <orgdiv>div1
   </aff>
  </author>

  <author>
   <fname>Other
   <surname>Authoro
   <role>Author
   <aff>
    <orgname>Org2
    <orgdiv>div2
   </aff>
  </author>
 
 </authgrp>

In other words, I should display the Orgs and divs in another location of the
end document - each (Orgn, divn) pair on its on line, like.

Org1, div1
Org2, div2

I have managed to navigate from under a sibling of the AUTHGRP and get a list
that includes all the children of all the AFF elements. Like this:

(define (*affstring*)
    (let ((x
    (children
     (select-elements
       (children
        (select-elements
            (children
             (select-elements
              (children
               (ancestor "FRONT"       (current-node)))
             '(AUTHGRP)))
        '(AUTHOR)))
     '(AFF)))
))
     x
))

So far so fine.

But the first appproach that I tried only displays the last member of the
node list produced by the above code. It just gives me 'div2'.

;;
;; doesn't work - some day I'll understand why...
;;
(define (node-list-display nl)
        (node-list-reduce nl
            (lambda (result snl)
                    (if (equal? (gi snl) "ORGNAME")
                        (make display-group (literal (data snl)))
                        (make sequence (literal (data snl)))
                    )
            )
             ""))

  ...
 (node-list-display (*affstring*))
  ...


Then I thought of a workaround. If I could append all the parts to one
string, with line breaks before each ORGNAME, and then display it all at
once, it would
be not elegant, but perhaps sufficient. But I can't get that to work
either. I have tried to define the *newline* as "&#10;&#13;" and a few ways
of naming or quoting the newline. I even tried to get the thing to produce
"\line", which is RTF for newline, but no avail. I get all the elements but
I don't get the line break. 
                                                                              
(define (node-list-to-string nl)
          (node-list-reduce nl
                (lambda (result snl)
                       (if (equal? (gi snl) "ORGNAME")
                            (string-append result  (*newline*) (data snl))
                        (string-append result ", " (data snl))                
                    )                                                         
            )                                                                 
             ""))                                                             
                                                                              
...
(make display-group (literal (node-list-to-string (*affstring*))))
...

If somebody knows how, or why, or even where to read, I would really
appreciate.

TIA,

        - Mikko

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


Current Thread