Re: Oft-encountered formatting problem

Subject: Re: Oft-encountered formatting problem
From: hanche+dsssl-l@xxxxxxxxxxxx
Date: 26 May 1997 12:35:56 -0000
- Frank Christoph <christo@xxxxxxxxxxxxxxxxxx>

| Hello DSSSL programmers,
| 
| There is a problem I have encountered more than once when trying to format
| SGML or SGML-like data in order to emulate the results of older, mostly ad-hoc
| formatting methods.  The problem is that structure of the formatted document
| does not match the element structure of the SGML document.  For example,
| the data might look like this:
| 
|   <SEC>
|   <COMPANY>Big-Time Do-Nothing Company</COMPANY>
|   <DESC>We charge lots of money for things you can do yourself.</DESC>
|   <MAINOFFICE>BTDN 666 Big Blvd., New York</MAINOFFICE>
|   <BRANCHOFFICE>BTDN Los Angeles Branch</BRANCHOFFICE>
|   <BRANCHOFFICE>BTDN Boston Branch</BRANCHOFFICE>
|   <BRANCHOFFICE>BTDN Tokyo Branch</BRANCHOFFICE>
|   <BRANCHOFFICE>BTDN Paris Branch</BRANCHOFFICE>
|   </SEC>
| 
| where SEC is something like
| 
|   <!ELEMENT SEC - - (COMPANY,DESC,MAINOFFICE,BRANCHOFFICE*)>
| 
| and it ought to be formatted like this:
| 
|   Big-Time Do-Nothing Company
| 
|     We charge lots of money for things you can do yourself.
| 
|                          Main Office
|                   BTDN 666 Big Blvd., New York
| 
|                         Branch Offices
|   BTDN Los Angeles Branch               BTDN Tokyo Branch
|   BTDN Boston Branch                    BTDN Paris Branch
| 
| So all the branch offices ought to be directed into the ports of a
| column-set-sequence, but since they are on the same level as, for example,
| MAINOFFICE and not grouped together as the only children of some other
| element (maybe called "BRANCHOFFICES"), there is no good place to put
| the column-set-sequence flow object.

Not (yet?) being a DSSSL expert myself, I'll take a shot at this
anyhow.  I think a solution along the following lines (leaving out all
sorts of hairy details) ought to work:

(element (DESC)
	 (with-mode no-branches
		    (process-children))
	 (make column-set-sequence
	       (process-matching-children BRANCHOFFICE)))

(mode no-branches
      (element (BRANCHOFFICE)
	       (empty-sosofo)))

Using modes together with the query language seems like a fairly
powerful combination.

- Harald

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


Current Thread