new layout and style for comments

Subject: new layout and style for comments
From: Andy Dent <dent@xxxxxxxxxxxxx>
Date: Thu, 18 Mar 1999 10:19:12 +0800
As some of you may remember, we have a cross-platform report-writer (in
C++) which produces Mac and WIndows GUI output, RTF and some HTML. The
non-GUI output can also run on Unix (ie: it's plain C++ with no
platform-specific assumptions).

Over the last 6 months I've had a project going to make it able to save to
XML, and read back a report from those XML documents.

In this project we've ended up defining our own very high level layout
specifications as both CSS and XSL are too detailed and lack some
high-level constructs (eg: simple way to specify tables, any graph spec) we
needed. For things like font styles etc. we are using CSS.

Whilst the code to read and write the following is not quite complete,
here's a sample of output and I'm interested in your comments. This first
version is being produced to a very pragmatic deadline to achieve the
reading and writing of reports for a local client, so we have room to
change our specs for future commercial releases.

The key points are:
1) a triple model, where layout of the page is described separately from
mere stylistic info (such as margins, font styles).

2) minimal syntax:
- ultimately the structure of the XML would be used to infer a page layout
if not specified (eg: a sequence of nested tables)
- a simple layout like <table source="students"/> suffices to describe a
single tabbed display.

3) source in future might be external files including dBase, tabbed and CSV
text files etc., not just XML. A MIME type and URI would probably be used
to specify alternates.


OVERALL STRUCTURE
(the "data" portion in this example is <students> and nested <grades>)

<report>
   <layout>...</layout>
   <style>...</style>
   <students>
      <grades>...</grades>
   </students>
</report>

or, a richer model used when several different reports are combined into
one for previewing in a single window (and saving to one Word file etc.
which is where the use of <section> comes from)

<report type="multiple">
   <section start-page-number="23">
      <layout>...</layout>
      <style>...</style>
      <students>
         <grades>...</grades>
      </students>
   </section>
</report>


MORE CONCRETE EXAMPLE WITH RICH SPECIFICATION OF HEADERS AND FOOTERS
AND NESTED GRAPH
<report>
   <layout ID="1" >
      <header page="first">
         <space ID="1-2" height="3"/>
         <box ID="1-3" width="100%">
            <inline ID="1-3-1" > School Title  </inline>
            <br/>
            <inline ID="1-3-2" > Student List  </inline>
            <br/>
            <inline ID="1-3-3" > Date: 2/3/1999   </inline>
         </box>
      </header>
      <table ID="1-4" source="students">
         <break when="each" where="after">
            <graph source="marks" type="column"/>
         </break>
      </table>
      <footer ID="1-5" page="first">
         <space height="3"/>
         <HR height="2"/>
         <box ID="1-5-10" >
             <inline ID="1-5-10-1" > Student List Footer   </inline>
             <br/>
             <inline ID="1-5-10-2" type="page number" leading-text="Page "/>
         </box>
         <space height="4"/>
      </footer>
   </layout>

   <style>
      #1 {font-size:10; font-family: Helvetica}
      #1-3 {font-size:14; font-weight:bold; font-style: italic}
      #1-5 {font-size:9}
   </style>

   <students>
      <student>
         <name>Andy Dent</name>
         <teacher>Mr Jones</teacher>
         <marks>
            <eng101>53</eng101>
            <eng102>65</eng102>
         </marks>
      </student>
      <student>
         <name>Phil Smith</name>
         <teacher>Mr Jones</teacher>
         <marks>
            <eng101>88</eng101>
            <eng102>76</eng102>
         </marks>
      </student>
      <student>
         <name>Jennie Whills</name>
         <teacher>Mr Jones</teacher>
         <marks>
            <eng101>73</eng101>
            <eng102>69</eng102>
         </marks>
      </student>
   </students>
</report>

Andy Dent BSc MACS AACM, Software Designer, A.D. Software, Western Australia
OOFILE - Database, Reports, Graphs, GUI for c++ on Mac, Unix & Windows
PP2MFC - PowerPlant->MFC portability
http://www.oofile.com.au/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread