Back to slide -- Keyboard shortcut: 'u'  next  next  meta.laml - Use of meta keywords.Slide 22 : 26
Program 2

(load (string-append laml-dir "laml.scm"))
(laml-style "simple-xhtml1.0-transitional-validating")
(lib-load "xhtml1.0-convenience.scm")

(define meta-props 
 (list 'http-equiv "Content-Type" 'content "text/html; charset=iso-8859-1"))

; Return a meta text keywords from the emphasized words in the entire document.
(define (meta-from-keywords root-ast parent-ast)
  (let ((meta-contributions 
          (traverse-and-collect-all-from-ast 
             root-ast
             (lambda (ast)
               (and (equal? (ast-element-name ast) "span")
                    (equal? (ast-attribute ast 'class #f) "keyword")))
             ast-text)))
    (meta 'name "keywords" 'content (list-to-string meta-contributions ","))))

(define keyword 
  (xml-in-laml-abstraction 
    (lambda (c a) (span 'class "keyword" c a))))


(write-html '(pp prolog)
 (html 
  (head 
   (meta meta-props) 
   meta-from-keywords    
   (title "Demo of simple document reflection"))
  (body 
    (h1 "Illustration of 'distributed meta'")

    (p "This is a demo of simple document introspection aided by" 
       (keyword "delayed procedural content items")_ "." )

    (p "A delayed procedural content item is a" (keyword "closure") 
       "which is evaluated at" (keyword "documentation expansion time") _ "." )

    (p "We show how to extract" (keyword "meta keywords") 
       "from designated and marked up keywords in the text. Notice that the keyword
        element mirror function is produced by an XML-in-LAML abstraction." )

    (when-generated))))

(end-laml)