|
|||||
XML to HTML conversions: basic formatting | |||||
Related Concepts |
Introduction
Describing the basic mapping from XML to HTML in OmniMark is extremely simple and straightforward. This sample uses a book metaphor for the incoming information. (It also assumes the HTML information will be created in the same order as the XML information is stored). A series of element rules is all that is necessary to perform the basic formatting.
Here is a simple example of the OmniMark element rules used to process the book's glossary:
element glossary output "%n%n<h2>Glossary</h2>%n%n" _ "<ul>%n%c" _ "</ul>%n" element term output "<li>%c:" element defn output " %c%n"
The respective element rules are "fired" as OmniMark processes the XML data. The rules fire in a nested fashion, just as the elements are nested in the XML document. So, the following XML data:
<glossary> <term>trigger<defn>The thing that makes the thing shoot. <term>laser doohicky<defn>The part that shoots. <term>battery chamber<defn>The thing that holds the batteries. <term>handle<defn>The thing you hold. </glossary>will be converted by OmniMark to the following HTML:
<h2>Glossary</h2> <ul> <li>trigger: The thing that makes the thing shoot. <li>laser doohicky: The part that shoots. <li>battery chamber: The thing that holds the batteries. <li>handle: The thing you hold. </ul>
Related Concepts
XML to HTML conversions |
---- |