chickadee » sxml-transforms » universal-conversion-rules

universal-conversion-rulesconstant

Bindings for the pre-post-order function, which traverses the SXML tree and converts it to a tree of fragments. It contains rules to call string->goodHTML, enattr and entag on all text, attributes and tags. In normal situations you always append these rules to your own rules, or add a final pre-post-order processing step with just these bindings.

Note that non-string text nodes (such as symbols, numbers and chars) will not be escaped by default. To escape them, you can override the text node handler. For example,

`((*text* . ,(lambda (tag body)
               (string->goodHTML (->string body))))
  . ,universal-conversion-rules)

On Chicken, universal-conversion-rules has been augmented a bit. The following rule has been added:

(& ENTITY-NAME ...)

which quotes character references given by strings ENTITY-NAME .... For example,

(& "ndash" "quot")
 => "–""