XSL Challenge

Andy Dent dent at oofile.com.au
Sat Jun 5 23:59:02 BST 1999


At 8:25 -0400 5/6/99, Roger Costello wrote:
>It looks simple.  It is deceptively challenging.
>
>An XML document stores database data as follows:
>
><?xml version="1.0"?>
><DynamicTable>
>        <Columns>
>                <Column name="col1"/>
>                <Column name="col2"/>
>        </Columns>
>        <Rows>
>            <Row>

...

>So the HTML table
>should look like this:
>
>           col1    col2
>           A       C
>           E       S
...

Hmmm

It's not quite applicable, but this is very close to the kind of 
layout problems we solve in our report writer. I found XSL syntax too 
complex for our purposes (machines and humans writing, machine 
parsing back into report definitions).

The following annotated sample gives an idea of what our output looks 
like, more examples at 
<ftp://ftp.highway1.com.au/pub/adsoftware/xml/reportOutput/> and I'm 
really interested in having them criticised.

<?xml version='1.0' standalone='yes'?>
<report ID='1'>

<!-- embedded schema
      The following is based largely on the XML Schema working group draft
      http://www.w3.org/TR/xmlschema-1/ with our own datatypes
      (eg: ui2) defined below being compatible with Microsoft's data
      types in XML-Data, except format of date, time etc. defined in
      http://msdn.microsoft.com/xml/schema/reference/datatypes.asp

      Our dbFields are <elementType>s nested within the <elementType> of
      the table, rather than the MS approach of declaring an <elementType>
      then using an IDRef in the <element> type attribute. This was partly
      to speedup development of our first release of schema parsing and
      partly because our database, like most others, allows field names
      to be reused within the local scope of a table and

       We use length attributes in the <datatype> to indicate string
       and base64 fixed length fields following the facets discussed in
       http://www.w3.org/TR/xmlschema-2/
-->
   <schema
       xmlns:dt='http://www.w3.org/xmlschemas/datatypes'>

       <elementType name='dbStudents'>
          <elementType name='Last_Name'>
             <datatypeRef name='string' length='25'/>
          </elementType>
          <elementType name='First_Name'>
             <datatypeRef name='string' length='15'/>
          </elementType>
       </elementType>
    </schema>
 
 
<!-- our styles for text are specified using CSS strings and connected via
ID with the ID tag only being written by the report-writer for elements
which have a unique style (they cascade) in order to cut down on visual
clutter inside the XML
-->

   <style>
        #1-2-1{font-family: Helvetica; line-height: 1.000 ; font-size: 
10 ; color: rgb(0, 0, 0); text-align:  left}
     </style>



   <layout>
<!-- page header and footer descriptions skipped
the following table description generates a table as you require from
the given schema element dbStudents, adding a column for each element.

We already have <column> elements working for specifing overriding headers
and planned extensions are:
1) allow <column> to specify a source element (eg: Last_Name) within
    the main table source

2) allow the source attribute to indicate a filename, eg: a dBase file
    so the XML spec is layout only, pulling the data in directly from an
    external database.
-->
       <table ID='1-2-1' source='dbStudents'>
       </table>
    </layout>
 

<!-- data for dbStudents -->
   <dbStudents>
       <Last_Name>Carey</Last_Name>
       <First_Name>Marion</First_Name>
       <field2>Fixed Text</field2>

       <Last_Name>Dobson</Last_Name>
       <First_Name>Sharon</First_Name>
       <field2>Fixed Text</field2>

...

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/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list