| XML, Everywhere | Table of contents | Indexes | Pragmatic SGML-solutions in a telecommunications organization | |||
Stylesheet Driven SGML Transformation |
|
Nicolas Paris |
| AIS Software 17, rue Rémy Dumoncel Paris France 75014 Web: http://www.balise.com/ |
Biographical notice: |
Nicolas Paris |
ABSTRACT: |
Introduction |
|
The Programming Approach |
|
If we handle conversion to HTML using standard SGML transformation tools, then we end up with programs whose structure is similar to the following example (which uses the Balise language): |
element
TITLE [within
CHAPTER] { on start
{ cout << "<H1 align=left><FONT color=red>"; cout << "Chapter " + dec(cNum()) + "<BR>"; } on end
{ cout << "</FONT></H1>"; } } |
The Stylesheet Approach - Rendering Properties |
|
The creation of rendering specifications is the most intuitive part of the conversion problem. It also corresponds to the classic notion of a stylesheet, as defined in SGML editors, for instance. |
<STYLE NAME='CHAPTER,TITLE'> <TAG>"H1 align=left"</TAG> <COLOR>"red"</COLOR> <TEXT-BEFORE>"Chapter" + dec(cNum()) + "<BR>"</TEXT-BEFORE> </STYLE> |
If the transformation specification is the same, the way in which it is expressed is clearly different: |
Note that we are still using expressions of the Balise language to express data manipulations in the stylesheet. |
The WYSIWYG Approach |
|
A stylesheet editor |
![]() |
The interest of such an editor is to further reduce the design time: |
This part of the conversion can easily be specified in just a few hours with this type of interactive and WYSIWYG tool. |
The Stylesheet Approach - Structure Properties |
|
The structure part of an SGML/XML-to-HTML transformation process handles transformation issues such as: |
Document Fragmentation |
|
In practice, two kinds of fragmentation can be considered and combined: |
This specification can be achieved using a set of properties such as the following: |
Generating Hyperlinks |
|
Link generation can also be easily specified through a simple set of properties: |
Specifying Tables of Contents |
|
Generating tables of contents requires different aspects to be specified: |
The first step can be specified using two properties |
Finally, the rendering of the generated structure can be easily covered with the same properties as the rendering of document content. |
<STYLE NAME='HEADER'> <VIEW NAME='default'> <DECO-BEFORE>"<PRE>&toc; </PRE>"</DECO-BEFORE>
</VIEW> </STYLE> <STYLE NAME='SEC1'> <VIEW NAME='doc'> <ANCHOR>attr["ID"]</ANCHOR> <BGCOLOR>"white"</BGCOLOR> <FONT>"Arial "</FONT> . . . <TOC-NAMES>"toc"</TOC-NAMES> <TOC-TITLE>child("TITLE")</TOC-TITLE>
</VIEW> <VIEW NAME='toc'> <TAG>UL</TAG> </VIEW>
</STYLE> <STYLE NAME='SEC2'> <VIEW NAME='doc'> <ANCHOR>attr["ID"]</ANCHOR> <FONT>"Arial "</FONT> . . . <TOC-NAMES>"toc"</TOC-NAMES> <TOC-TITLE>child("TITLE")</TOC-TITLE>
</VIEW> <VIEW NAME='toc'> <TAG>UL</TAG> </VIEW>
</STYLE> <STYLE NAME='SEC3'> <VIEW NAME='doc'> <ANCHOR>attr["ID"]</ANCHOR> </VIEW> </STYLE> |
Reorganizing the Document |
|
To be able to derive such structure, it is necessary to build tables (or associations) containing, for instance, all SUMMARY elements classified by author names. |
This can also be achieved in a stylesheet approach. A |
<STYLE NAME='ARTICLE'> <VIEW NAME='doc'> <KEYS>setKey("abstract by author", attribute("AUTHOR"), child("ABSTRACT"))</KEYS> </VIEW> </STYLE> |
This table can then be used in another place to visit the list of articles written by an author as follows: |
<STYLE NAME='AUTHOR'> <VIEW NAME='abstractlist'> <TEXT-BEFORE>visit(getFromKey("abstract by author", attribute("ID")), "summary")<TEXT-BEFORE> </VIEW> </STYLE> |
Conclusion |
|
Using some common examples, we have shown that SGML/XML-to-HTML transformation can be expressed using stylesheets and that such declarative specifications can save a lot of development effort. |
This is the direction we will follow for the development of new "programming free" products based on the same core concepts and technologies. |
| XML, Everywhere | Table of contents | Indexes | Pragmatic SGML-solutions in a telecommunications organization | |||