Nicht alles, was hier folgt, ist neu. Jeweils die Anfangsteile der Listings waren auch Bestandteil der Style Sheets für die Wandlung des Buchmanuskripts in HTML (siehe voriges Kapitel). Da war tatsächlich Synergie am Werk, genauer: Einzelne Elemente sind für solche Style Sheets gut wiederverwendbar.
Bis zur default-Regel ist dieses Listing (Inhaltsverzeichnis) mit dem folgenden (Autorenausgabe) identisch. Es handelt sich dabei um die Deklaration des Dokumenttyps und die von James Clark zur Verfügung gestellten Flow Objects sowie die Funktion um copy-attributes. Die Vorgabe (default ...) in diesem Listing ist (empty-sosofo), damit nicht für die Elemente, die leere Statements bleiben sollen, dies jeweils anzugeben ist.
XML achtet auf Groß- und Kleinbuchstaben (neudeutsch: Es ist case-sensitiv). Und DOCTYPE muss hier eigentlich in Versalien stehen. Bei Jade 1.0.1 ergab sich durch die Kleinschreibung kein Problem, das könnte sich mit der neuen Version (1.1) ändern. Es dreht sich darum, dass ein XML-Parser auf Grund seiner Unterscheidung von Groß- und Kleinschreibung über eine solche Deklaration stolpern und einen Fehler signalisieren könnte.
Wie jeweils der ersten Zeile der beiden folgenden Listings zu entnehmen ist, handelt es sich um DSSSL-Style-Sheets — CSS kommt hier nur an den Stellen vor, an denen implizit auf eine existierende CSS-Datei verwiesen wird, zum Beispiel:
(make element gi: "TD" attributes: (cons (list "class" "mein-stil") '()) (process-children))
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN"> ; ----- Style Sheet für Inhaltsverzeichnis (declare-flow-object-class document-type "UNREGISTERED::James Clark//Flow Object Class::document-type") (declare-flow-object-class element "UNREGISTERED::James Clark//Flow Object Class::element") (declare-flow-object-class empty-element "UNREGISTERED::James Clark//Flow Object Class::empty-element") (define (copy-attributes #!optional (nd (current-node))) (let loop ((atts (named-node-list-names (attributes nd)))) (if (null? atts) '() (let* ((name (car atts)) (value (attribute-string name nd))) (if value (cons (list name value) (loop (cdr atts))) (loop (cdr atts))))))) (default (empty-sosofo)) ; ------ Horizontale Linien und Zeilenumbruch (define (horiz-rule) (make empty-element gi: "HR" attributes: (cons (list "class" "med") '()))) (define (small-horiz-rule) (make empty-element gi: "HR" attributes: (cons (list "class" "sm") '()))) (define br (make empty-element gi: "BR")) ; --------------------- top level: Element lithist ----------- (element lithist (make sequence (make document-type name: "HTML" public-id: "-//W3C//DTD HTML 4.0//EN") (make element gi: "HTML" (make sequence (make element gi: "HEAD" (make sequence (make element gi: "TITLE" (literal "Dichter und Schriftsteller")) (make empty-element gi: "LINK" attributes: (cons (list "REL" "STYLESHEET") (cons (list "TYPE" "text/css") (cons (list "HREF" "/style/ars.css") (cons (list "TITLE" "XML") '()))))) (make empty-element gi: "META" attributes: (cons (list "name" "generator" ) (cons (list "content" "from XML source and Style Sheet via James Clark's Jade") (cons (list "name" "author") (cons (list "content" "Henning Behme") '()))))))) (make element gi: "BODY" (make sequence (make element gi: "H1" attributes: (cons (list "class" "de") '()) (literal "Dichter und Schriftsteller")) (make element gi: "H1" attributes: (cons (list "class" "en") '()) (literal "Poets and Writers")) (make element gi: "H3" attributes: (cons (list "class" "de") '()) (literal "Sie haben die Wahl")) (make element gi: "H3" attributes: (cons (list "class" "en") '()) (literal "Take your pick")) (make element gi: "FORM" attributes: (cons (list "METHOD" "POST") (cons (list "ACTION" "/cgi-bin/xml/xmla") '())) (make element gi: "SELECT" attributes: (cons (list "NAME" "AUTHOR") (cons (list "SIZE" "15") '())) (process-children)) (make element gi: "INPUT" attributes: (cons (list "TYPE" "SUBMIT") (cons (list "VALUE" "okay") '())) (empty-sosofo))))))))) ; ----- Details pro Autor ------- (element (lithist author) (make element gi: "OPTION" attributes: (cons (list "VALUE" (attribute-string "ID")) '()) (process-matching-children 'name))) ; -------- weitere Elemente ----------------------- (element name (process-children)) (element fname (make sequence (process-children) (literal " "))) (element lname (process-children))