|
|||||
XML to HTML conversions: explicit hypertext | |||||
Introduction: XML to HTML conversions: explicit hypertext |
Sample
This program uses the mart.xml sample input file.
down-translate with xml ;use XML parser global counter chap-no initial {0} element #implied output "%c" element title when parent is doc local stream title set title to "%c" output "<title>%g(title)</title>%n" || "<h1>%g(title)</h1>%n" element audience output "<b>For:</b> <i>%c</i>%n" element p output "<p>%n%n%c" 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" ; Explicit links. element xref output '<a href="#exp-%v(idref)">' || referent "exp-%v(idref)" || '</a>%c' element chapter increment chap-no output '<a name="exp-%v(id)"></a>%n%c' element title when parent is chapter local stream chap-title set chap-title to "Chapter %d(chap-no), %c" output "<h2>%g(chap-title)</h2>%n" using attribute id of parent set referent "exp-%v(id)" to chap-title
---- |