!!! Listing 1 1 3 (declare-flow-object-class element 4 "UNREGISTERED::James Clark//Flow Object Class::element") 5 6 7 (declare-flow-object-class empty-element 8 "UNREGISTERED::James Clark//Flow Object Class::empty-element") 9 (declare-flow-object-class entity-ref 10 "UNREGISTERED::James Clark//Flow Object Class::entity-ref") 11 12 (define (copy-attributes #!optional (nd (current-node))) 13 (let loop ((atts (named-node-list-names (attributes nd)))) 14 (if (null? atts) 15 '() 16 (let* ((name (car atts)) 17 (value (attribute-string name nd))) 18 (if value 19 (cons (list name value) 20 (loop (cdr atts))) 21 (loop (cdr atts))))))) 22 23 (default (make element 24 attributes: (copy-attributes))) !!! Listing 2 1 2 3 6 Edgar AllanPoe 7 8 1809119 9 BostonUSA 10 1849107 11 BaltimoreUSA 12 13 14 Tamerlane and other Poems 15 1827 16 MS. Found in a Bottle 17 1833 18 The Narrative of Arthur Gordon Pym 19 1838 20 Tales from the Grotesque and Arabesque 21 1840 22 The Raven 23 1845 24 http://www.heise.de/ix/raven/literature/Authors/Poe.html 25 26 Berühmt wegen seiner Kriminalgeschichten 27 und des Gedichts "The Raven". Seine erste Sammlung von 28 Stories veröffentlichte er als "von einem Bostoner". 29 Famous for his detective stories and the 30 poem "The Raven". His first collection of stories 31 (Tamerlane ...) were 32 published as "by a Bostonian". 33 34 !!! Listing 3 1 (default (empty-sosofo)) 2 3 ; ------------------- generate title and metadata -------- 4 5 (mode prolog 6 (default (process-node-list 7 (select-elements 8 (descendants (current-node)) 'lithead))) 9 10 (element (lithist lithead) 11 (make sequence 12 (if (= (child-number) 1) 13 (make sequence 14 (make element gi: "TITLE" (process-children)) 15 (make empty-element gi: "LINK" 16 attributes: (cons (list "REL" "STYLESHEET") 17 (cons (list "TYPE" "text/css") 18 (cons (list "HREF" "/style/xml.css") 19 (cons (list "TITLE" "XML") 20 '()))))) 21 (make empty-element gi: "META" 22 attributes: (cons (list "name" "generator" ) 23 (cons (list "content" "from XML source and Style Sheet via James Clark's Jade") 24 (cons (list "name" "author") 25 (cons (list "content" "Henning Behme") 26 '())))))) 27 (empty-sosofo)) 28 29 ))) 30 31 32 ; ---------------- some horizontal rules for display ------- 33 34 (define (horiz-rule) 35 (make empty-element gi: "HR" 36 attributes: (cons (list "class" "med") 37 '()))) 38 39 (define (small-horiz-rule) 40 (make empty-element gi: "HR" 41 attributes: (cons (list "class" "sm") 42 '()))) 43 44 ; --------------------- top level: LITHIST ----------------------------- 45 46 (element lithist 47 (make sequence 48 (make document-type 49 name: "HTML" 50 public-id: "-//W3C//DTD HTML 4.0//EN") 51 (make element gi: "HTML" 52 (make sequence 53 (make element gi: "HEAD" 54 (with-mode prolog (process-matching-children 'lithead))) 55 (make element gi: "BODY" 56 (make sequence 57 (make element gi: "P" 58 attributes: (cons (list "class" "note") 59 '()) 60 (literal "This is the proverbial 61 work in progress; sorry for any delay.")) 62 (process-matching-children 'lithead) 63 (make element gi: "FORM" 64 attributes: (cons (list "METHOD" "POST") 65 (cons (list "ACTION" "/cgi-bin/xml/xmla") 66 '())) 67 (make element gi: "SELECT" 68 attributes: (cons (list "NAME" "AUTHOR") 69 '()) (process-matching-children 'author)) 70 (make element gi: "INPUT" 71 attributes: (cons (list "TYPE" "SUBMIT") 72 (cons (list "VALUE" "Choose one") 73 '())) (empty-sosofo))) 74 75 (small-horiz-rule) 76 (make element gi: "P" 77 attributes: (cons (list "class" "small") 78 '()) 79 (literal "Last modification: Febuary 2, 1998")))))))) 80 81 ; -- heads in two languages --------------------- 82 83 (element lithead 84 (if (first-sibling?) 85 (make element gi: "H1" ) 86 (make sequence 87 (make element gi: "H1" 88 attributes: (cons (list "class" "eng" ) 89 '())) 90 (make element gi: "H3" 91 (literal "Sie haben die Wahl")) 92 (make element gi: "H3" 93 attributes: (cons (list "class" "eng") '()) 94 (literal "Take your pick")) 95 96 (horiz-rule)))) 97 98 ; ----- details per author ------- 99 100 (element author 101 (make element gi: "OPTION" 102 attributes: (cons (list "VALUE" (attribute-string "ID")) 103 '()) (process-matching-children 'name))) 104 105 ; -------- other elements ----------------------- 106 (element name 107 (process-children)) 108 109 (element fname 110 (make sequence 111 (process-children) 112 (literal " "))) 113 114 (element lname 115 (process-children)) !!! Listing 4 1 2 (default (process-children)) 3 4 (process-matching-children 'lithead) 5 (process-matching-children 'author) 6 ; ... 7 8 ; ------ zwei Ueberschriften : fehlen hier 9 10 ; -------------------- element: author ------------ 11 12 (element author 13 (if (string=? thisAuthor (attribute-string "ID" (current-node))) 14 (make sequence 15 (make element gi: "H3" 16 (process-matching-children 'name)) 17 (make element gi: "TABLE" 18 attributes: (cons (list "border" "0") 19 (cons (list "cellspacing" "0") 20 (cons (list "cellpadding" "2") 21 (cons (list "width" "100%") 22 '())))) 23 (make element gi: "CAPTION" 24 (make element gi: "H3" 25 (literal "Leben und Werk/Life and Works"))) 26 (process-matching-children 'vita) 27 (make element gi: "TR" 28 (make element gi: "TD" 29 attributes: (cons (list "colspan" "3") 30 '()) (horiz-rule))) 31 (process-matching-children 'works))) 32 (empty-sosofo))) 33 34 35 ; ---------------------- (not so gory) details 36 37 (element born 38 (make element gi: "TR" 39 (make element gi: "TH" 40 attributes: (cons (list "bgcolor" "#ccccff") 41 '()) 42 (process-matching-children 'year)) 43 (make element gi: "TD" 44 attributes: (cons (list "bgcolor" "#ccccff") 45 '()) 46 (process-matching-children 'day) 47 (literal "/") 48 (process-matching-children 'month)) 49 (make element gi: "TD" 50 attributes: (cons (list "bgcolor" "#333366") 51 '()) 52 (make element gi: "SPAN" 53 attributes: (cons (list "class" "white") 54 '()) 55 (process-matching-children 'where))))) 56 57 58 ; ---------------------- (not so gory) details 59 60 (element died 61 (make element gi: "TR" 62 (make element gi: "TH" 63 attributes: (cons (list "bgcolor" "#ccccff") 64 '()) 65 (process-matching-children 'year)) 66 (make element gi: "TD" 67 attributes: (cons (list "bgcolor" "#ccccff") 68 '()) 69 (process-matching-children 'day) 70 (literal "/") 71 (process-matching-children 'month)) 72 (make element gi: "TD" 73 attributes: (cons (list "bgcolor" "#333366") 74 '()) 75 (make element gi: "SPAN" 76 attributes: (cons (list "class" "white") 77 '()) 78 (process-matching-children 'where))))) 79 80 81 ; ---------------------- born/died where? 82 83 (element (born where) 84 (make sequence 85 (literal "geboren/born: ") 86 (process-matching-children 'place) 87 (literal " - ") 88 (process-matching-children 'country))) 89 90 (element (died where) 91 (make sequence 92 (literal "gestorben/died : ") 93 (process-matching-children 'place) 94 (literal " - ") 95 (process-matching-children 'country))) 96 97 ; --------------- show the works of the author -------- 98 99 (element works 100 (make sequence 101 (make element gi: "TR" 102 (make element gi: "TH" 103 attributes: (cons (list "bgcolor" "#ccccff") 104 '()) 105 (process-matching-children 'year)) 106 (make element gi: "TD" 107 attributes: (cons (list "bgcolor" "#333366") 108 (cons (list "colspan" "2") 109 '())) 110 (make element gi: "SPAN" 111 attributes: (cons (list "class" "white") 112 '()) 113 (process-matching-children 'title))) 114 ))) 115 116 ; ---------------------- (not so gory) details 117 118 (element fname 119 (make sequence 120 (process-children) 121 (literal " "))) 122 123 (element url (empty-sosofo)) 124 (element event (empty-sosofo)) 125 (element comment (empty-sosofo))