RE: (dsssl) DSSSL engines for ASCII output

Subject: RE: (dsssl) DSSSL engines for ASCII output
From: "Maltby, David G" <david.g.maltby@xxxxxxxx>
Date: Tue, 17 Apr 2001 12:38:01 -0400
On Apr 17, 2001, John R. Sheets wrote:
> On Apr 17, 2001, jany.quintard@xxxxxxxxxx wrote: 
> > On Sun, 15 Apr 2001, John R. Sheets wrote:
> > 
> > > What's the best way to output straight ASCII, based on a DSSSL
> > > stylesheet?  [snip]
> > For this I use the SGML backend with an entity to build the file and I
> > output the text using (literal ...).
> > I think the result is easy to transform using perl, python.
> 
> Could you give a quick example of what's involved here?  Why is the
> entity flow object so critical here?

Sure. This script pulls out all the figure graphic names and figure titles
from my documents and writes the information into a formatted list in the
form of:

name1$title1
name2$title2...

The (declare-flow-object-class entity "UNREGISTERED::James Clark//Flow
Object Class::entity") is not needed for this transform.  I am using the
sgml backend.

<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">
<style-specification> 

(default (process-node-list (element-children)))

;; (element-children snl) finds all of the elements that are direct
;; children of singleton nodelist "snl".  This is useful for
;; filtering, processing, and counting, when you're not interested in
;; any text, PI, or comment nodes. Thanks to Chris Madden.
(define (element-children #!optional (snl (current-node)))
   (select-by-class (children snl)
                    'element))

(element figure
  (let loop ((rtn-sosofo (empty-sosofo))
             (gnl (select-elements (children (current-node)) "graphic")) 
             (tnl (select-elements (children (current-node)) "title")))
    (if (node-list-empty? gnl)
      rtn-sosofo
      (loop
        (sosofo-append rtn-sosofo 
          (literal (string-append 
            (attribute-string "name" (node-list-first gnl)) 
              "$" (data (node-list-first tnl)) %newline%)))
        (node-list-rest gnl)
        tnl))))

(define %newline% "
")

</style-specification> 

Regards, David Maltby, Computer System Design Engineer
Lockheed Martin Space Systems, Inc.
Cocoa Beach, FL 
if (opinion.mine != opinion.employer)
  delete opinion.mine;



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

Current Thread