define-element
syntax
The grammar for the define-element
syntax is:
element-definition ::= (define-element (element-tag namespace-uri)) | (define-element (element-tag #f)) | (define-element element-tag)
element-tag must be a symbol. If present, namespace uri is a string containing a uri.
define-element
introduces the following bindings:
element-tag
: a constructor function for the element type defined by define-element.element-tag?
: a predicate function for the element type defined by define-element.The example below defines an element 'group':
(define-element group)
The code fragment below illustrates the use of both the constructor group
and the predicate group?
.
(group? "test") ; ==> #f (group? (group "body")) ; ==> #t
define-attribute
syntax
The grammar for the define-attribute
syntax is:
attribute-definition ::= (define-attribute (attribute-tag namespace-uri)) | (define-attribute (attribute-tag #f)) | (define-attribute attribute-tag)
attribute-tag must be a symbol. If present, namespace uri is a string containing a uri.
define-attribute
introduces the following bindings:
attribute-tag:
: a keyword used for construction of the the attribute defined by define-attribute.attribute-tag?
: a predicate function, taking an element as its argument. If the element contains the attribute 'attribute-tag', the value of the attribute is returned. Otherwise #f.The example below defines an attribute 'label':
(define-attribute label)
The code fragment below illustrates the use of both the constructor label:
and the predicate label?
.
(label? (group "body")) ; ==> #f (label? (group label: "a" "body")) ; ==> "a"