(load (string-append laml-dir "laml.scm")) (laml-style "simple-xhtml1.0-transitional-validating") (lib-load "xhtml1.0-convenience.scm") (set-xml-accept-extended-contents-in 'xhtml10-transitional #t) (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 (count-elements el-name) (lambda (root-ast parent-ast) (length (match-ast root-ast (location-step 'descendant "p"))))) (define keyword (xml-in-laml-abstraction (lambda (c a) (span 'class "keyword" c a)))) (write-html '(pp prolog) (html (head (meta meta-props) (title "Demo of simple document reflection")) (body (h1 "Illustration of element counting") (p "This document has" (count-elements "p") "paragraphs.") (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)