Generated: June 17, 2005, 17:51:43 Copyright © 2005 , Kurt Nørmark The local LAML software home page

Reference Manual of the XML-in-LAML library

Kurt Nørmark © normark@cs.auc.dk Department of Computer Science Aalborg University Denmark

Source file: lib/xml-in-laml/xml-in-laml.scm/

The XML-in-LAML common parts, which are shared between all XML-in-LAML languages. The library is used together with XHTML 1.0 transitional, XHTML 1.0 strict, XHTML 1.0 frameset, XHTML1.1, SVG 1.1, LENO, and other similar mirrors.

This library loads the the LAML finite state automation library for the sake of full document validation at document generation time.

The XML-in-LAML Mirror Generation tool is able to create a set of Scheme mirror functions for a given XML DTD. The generated mirror functions together with the shared XML-in-LAML common library (this file) make up the effective mirror of an XML language.

This library is also designed to co-exists with non-validating HTML mirrors, such as Html4.0 (mainly the sake of LENO). However, it cannot be used together with other validating AST-based HTML mirrors, such as Html4.01 transitional validating. You should use a 100% XML-IN-LAML solution instead. By that we mean a solution, where also the HTML stuff is based on XML-in-LAML. In practical terms, it means that you should use one of the XHTML mirrors mentioned above.

Table of Contents:
1. XML front matters and end matters stuff. 10. XML Processing Instructions. 19. Rendering functions and procedures.
2. XML-in-LAML processing parameters. 11. XML language bookkeeping. 20. Element related functions.
3. Other Constants. 12. The language map. 21. XML in LAML parametrization and abstraction functions.
4. AST constructors and basic selector selectors. 13. XML navigation information. 22. AST traversal and AST transformation functions.
5. High-level AST selector functions. 14. Mirror generation functions. 23. XML validation procedures.
6. XML-in-LAML predicates. 15. Contents validation. 24. Element content models.
7. Character entities. 16. Attribute checking. 25. Action procedure map.
8. XML Comments. 17. Link checking. 26. Other useful functions.
9. XML CDATA Sections. 18. XML warning procedures.

Alphabetic index:
_ _ The symbolic name of explicit white space suppress.
action-procedure-map-of (action-procedure-map-of language) Return the action procedure map of the XML language.
action-procedure-of-language (action-procedure-of-language element-name language) Return the action procedure of the XML element named element-name in the XML language.
action-procedure-of-map (action-procedure-of-map element-name action-procedure-map) Return the action procedure of the XML element named element-name relative to the action procedure map action-procedure-map.
activator-via-language-map (activator-via-language-map language) Return an activator function for language.
ast-attribute (ast-attribute ast name [default-attribute-value]) Return the value of the attribute name in ast.
ast-attributes (ast-attributes ast) Return the list of attributes of the ast.
ast-element-name (ast-element-name ast) Return the root element name of ast.
ast-kind (ast-kind ast) Return the kind of the ast.
ast-language (ast-language ast) Return the language of the ast.
ast-of-type? (ast-of-type? type name) A higher-order function that returns an AST predicate, which checks if the type of the AST is name.
ast-strong? (ast-strong? x) Is the parameter x an AST in a stronger interpretation than ast? Using the native LAML representation, ast-strong? and ast? are identical.
ast-subtree (ast-subtree ast el-name [n]) Return a specific subtree of ast, namely the n'th subtree with element-name el-name.
ast-subtrees (ast-subtrees ast) Return the list of substrees of ast.
ast-text (ast-text ast) Return a string of the aggregated CDATA contents of ast.
ast-text-deep (ast-text-deep ast) Return a string of the aggregated CDATA contents of ast.
ast-to-parse-tree (ast-to-parse-tree ast) Convert an abtract syntax tree to a parse tree.
ast? (ast? x) Is the parameter x an AST.
attribute-getter (attribute-getter attribute-name [default-value]) A higher-order function which returns an attribute getter function on ASTs.
base-url-extractor-of-xml-language (base-url-extractor-of-xml-language xml-language) Return the registered base-url-extractor function of xml-language.
can-have-element-constituent? (can-have-element-constituent? ast el-name) Can ast have a direct or indirect constituent (sub-ast) with element name el-name.
causes-xml-in-laml-name-clash? (causes-xml-in-laml-name-clash? name) Is name involved in a name clash among the registered xml-in-laml languages?
cdata-section (cdata-section . cdata-text-list) Construct an XML CDATA section and return it.
cdata-section-contents (cdata-section-contents cdata-section) Return the cdata text of an XML comment.
cdata-section? (cdata-section? x) Is x an XML CDATA section?
cdata? (cdata? x) Is the parameter x CDATA
char-ref (char-ref x) Return a character reference value for x.
char-ref-value (char-ref-value char-ref-structure) Return the number or symbol of char-ref-structure.
char-ref? (char-ref? x) Is x a character reference.
check-absolute-url-lists (check-absolute-url-lists relative-urls absolute-urls) Checks the existense of the resources addressed by the urls in absoute-urls
check-id-and-idref-attributes! (check-id-and-idref-attributes!) Check that the ID and IDREF attribute values are used according to the XML 1.0 specification.
check-relative-url-lists (check-relative-url-lists relative-urls absolute-urls) Checks the existense of the resources addressed by the urls in relative-urls
collect-links-for-later-checking-in-ast! (collect-links-for-later-checking-in-ast! xml-ast absolute-target-html-file) Collect the urls in xml-ast, which are about to be written to the file absolute-target-html-file (full path).
content-model-map-of (content-model-map-of language) Returns the content model map (an association list) of a given XML language.
content-model-of (content-model-of element-name language) Return the content model of the element named element-name in XML language.
contents-data-strong? (contents-data-strong? x [language]) Is the parameter x a contents element item, with ASTs recognized in the strong form (using ast-strong?)
contents-data? (contents-data? x [language]) Is the parameter x a contents element item.
display-xml-warning (display-xml-warning . messages) A variant of display-warning which prefixes the warning text with a 'XML Warning' prefix.
element-names-of-language (element-names-of-language language) Return the element names of language, as defined by its language map.
end-laml (end-laml) A redefinition of end-laml from the fundamental LAML library.
end-tag-of (end-tag-of xml-clause) Render the end-tag of xml-clause (an LAML AST) and return the rendered string.
explicit-space explicit-space The explicit white space value, as used internally in ast.
explicit-space-suppress explicit-space-suppress The explicit white space suppress value.
extraordinary-allow-element? (extraordinary-allow-element? element-name context-element-name) Is element-name extraordinarily allowed within context-element-name (both symbols).
find-asts (find-asts ast el-name [ast-transformer]) Find and return a list of transformed sub ASTs of ast (first parameter) each with a root element of name el-name.
find-first-ast (find-first-ast ast el-name [ast-transformer]) Find and return a sub-AST of ast (first parameter) with a root element of name el-name.
forced-white-space? (forced-white-space? x) Is the parameter x a white space mark.
generate-xml-mirror-function (generate-xml-mirror-function validation-procedure tag-name default-dtd-attributes single-double-kind language overlap-check? action-procedure) Return an XML mirror surface function, in which textual content parameters and attribute value pairs can be given in a very liberal fashion.
get-mirror-function (get-mirror-function language-map element-name) Return the mirror function based on element-name from language map.
indentation-delta indentation-delta An integer which gives the level of indentation for pretty printed output.
laml-internal-representation laml-internal-representation A variable that determines the internal representation used for XML-in-LAML.
laml-source-prepare (laml-source-prepare laml-lst) Prepare laml-list to be used as input to a mirror function.
language-in-use? (language-in-use? language) is language in use - is it registered as an xml-in-laml language?
language-map-of (language-map-of language) Return the language map of language.
languages-in-use (languages-in-use) Return the list of language in used, as registered by register-xml-in-laml-language.
make-ast (laml-make-ast element-name contents attributes kind language) Make an AST given element-name, contents, a property list of attributes, a kind (single/double), and an XML language name.
possible-attributes-rooted-by-element (possible-attributes-rooted-by-element element-name language) Return a list of attribute names that can appear as direct or indirect constituents of an AST rooted by element-name.
possible-elements-rooted-by-element (possible-elements-rooted-by-element element-name language) Return a list of element names that can appear as direct or indirect constituents of an AST rooted by element-name.
preferred-maximum-width preferred-maximum-width An integer that expresses the prefered maximum column width for pretty printed ouput.
pretty-render-to-output-port (pretty-render-to-output-port xml-clause output-port [prolog epilog]) Pretty print the XML clause (an AST) to output-port.
pretty-xml-render (pretty-xml-render xml-clause [prolog epilog]) Pretty print xml-clause (an LAML AST) and return the rendered string.
process-ast! (process-ast! ast [given-language action-map]) Process the ast, the internal document representation, by means of the action procedures in action-map.
processing-instruction (processing-instruction pi-target . text-list) Construct an XML processing instruction and return it.
processing-instruction-contents (processing-instruction-contents pi) Return the processing instruction text part of the processing instruction pi.
processing-instruction-target (processing-instruction-target pi) Return the processing instruction pi-target of the processing instruction pi.
processing-instruction? (processing-instruction? x) Is x an XML processing instruction?
put-mirror-function (put-mirror-function language-map element-name mirror-function) Update the language map by the association of element-name and mirror function.
register-xml-in-laml-action-procedures (register-xml-in-laml-action-procedures language action-procedure-structure) Register the action procedure structure for XML language.
register-xml-in-laml-content-models (register-xml-in-laml-content-models language content-model-structure) Register the content model structure for XML language.
register-xml-in-laml-language (register-xml-in-laml-language language language-map) Register that language (the first parameter) is an XML language in use in the current LAML session.
register-xml-in-laml-navigator (register-xml-in-laml-navigator language navigator-structure) Register navigator-structure and an XML-in-LAML navigator for language.
register-xml-in-laml-validators (register-xml-in-laml-validators language validator-structure) Register validator-structure for language.
render-end-tag-to-output-port (render-end-tag-to-output-port xml-clause output-port) Render the end-tag of xml-clause (an LAML AST) and return the rendered string.
render-start-tag-to-output-port (render-start-tag-to-output-port xml-clause output-port) Render the start-tag of xml-clause (an LAML AST) to output-port.
render-to-output-port (render-to-output xml-clause output-port [prolog epilog]) Render the XML clause (an AST) to output-port.
required-implied-attributes (required-implied-attributes required-attribute-names implied-attribute-names [tag-name]) A higher-order function which returns an attribute checker.
set-xml-accept-extended-contents-in (set-xml-accept-extended-contents-in language new-value) Controls the handling of LAML element contents items in language.
set-xml-accept-only-string-valued-attributes-in (set-xml-accept-only-string-valued-attributes-in language new-value) Controls the handling of LAML attribute values in language.
set-xml-char-transformation-table-in (set-xml-char-transformation-table-in language new-value) Set the HTML/XML character transformation table used for language.
set-xml-link-checking-functions (set-xml-link-checking-functions xml-language url-extractor-function base-url-extractor-function) Register url-extractor-function and base-url-extractor-function in the XML link checking map of xml-language.
set-xml-transliterate-character-data-in (set-xml-transliterate-character-data-in language new-value) Ask for transliteration of all CDATA characters via an HTML/XML character transformation table.
standard-prolog (standard-prolog [language]) The standard-prolog function as redefined for XML.
start-tag-of (start-tag-of xml-clause) Render the start-tag of xml-clause (an LAML AST) and return the rendered string.
terminal-ast-node? (terminal-ast-node? x) Is x an ast nodes without subtrees?
transform-ast (transform-ast ast . transform-specs) Transform ast by means of transform-specs.
transform-ast-list (transform-ast-list input-list . transform-specs) Apply the transformation-specs on input-list and return a list of transformed input elements.
traverse-and-collect-all-from-ast (traverse-and-collect-all-from-ast ast-tree node-interesting? ast-transformer) Traverse all nodes of the AST ast-tree, and return transformed subtrees that satisfy the node-interesting? predicate.
traverse-and-collect-first-from-ast (traverse-and-collect-first-from-ast ast-tree node-interesting? ast-transformer) Traverse the AST ast-tree, and return a transformation of the first subtree which satisfies the predicate node-interesting.
unique-ast-attribute (unique-ast-attribute ast name [default-attribute-value]) Return the value of the attribute name in ast, or in one of the subtrees of ast.
url-extractor-of-xml-language (url-extractor-of-xml-language xml-language) Return the registered url-extractor function of xml-language.
validate-as-pcdata! (validate-as-pcdata! contents tag-name) Validate that contents is pure PCDATA.
validate-ast! (validate-ast! ast [given-language language-overlap-check?]) Validate ast.
validate-contents-by-dfa! (validate-contents-by-dfa! contents dfa tag-name) Apply the deterministic finte state automaton dfa on contents.
validate-mixed-contents-by-simple-means! (validate-mixed-contents-by-simple-means! contents symbol-choice-list tag-name) Validate that contents corresponds to mixed contents.
validation-procedure-map-of (validation-procedure-map-of language) A validation procedure map of an XML language is a sorted, associative vector that maps element names to XML validation procedures.
validation-procedure-of (validation-procedure-of element-name language) Return the XML validation procedure of the element named element-name in language.
white-space-related? (white-space-related? x) Is the parameter x white space related?
white-space-suppress? (white-space-suppress? x) Is the parameter x a white suppress space mark.
with-xml-language (with-xml-languge language-name . forms) A macro which globally establishes the name bindings of xml-language and evaluate forms in this state.
with-xml-language! (with-xml-languge! language-name minus-elements . forms) A macro which globally establishes the name bindings of xml-language and evaluate forms in this state.
xml-accept-extended-contents-in? (xml-accept-extended-contents-in? language) A boolean variable that controls how rigid LAML handles element contents items.
xml-accept-only-string-valued-attributes-in? (xml-accept-only-string-valued-attributes-in? language) A boolean variable that controls how rigid LAML handles attribute values in language (first parameter).
xml-always-render-white-space? xml-always-render-white-space? Controls the rendering of white space in the textual contents.
xml-char-transformation-table-in (xml-char-transformation-table-in language) Return the HTML/XML character transformation table used for language.
xml-check-attributes! (xml-check-attributes! attributes dtd-attribute-definition number-of-req-attributes tag-name) Check the attributes (first par) in the calling form against the attribute definitions taken from the DTD file (second par).
xml-check-attributes? xml-check-attributes? A boolean variable which controls the checking of element attributes.
xml-check-error (xml-check-error . messages) The procedure that reports XML validation errors.
xml-check-language-overlap? xml-check-language-overlap? A boolean variable that controls the check of XML language overlap.
xml-comment (xml-comment . comment-text-list) Construct an XML comment and return it.
xml-comment-contents (xml-comment-contents xml-comment) Return the comment text of an XML comment.
xml-comment? (xml-comment? x) Is x an XML comment?
xml-declaration (xml-declaration) Return the xml declaration
xml-document-type-declaration-in (xml-document-type-declaration-in language) Return the document type declaration of language.
xml-duplicated-attribute-handling (xml-duplicated-attribute-handling language) This value controls the handling of attributes that occur more than once in an XML attribute list.
xml-error-truncation-length xml-error-truncation-length How many characters of the validation error messages to be presented.
xml-in-laml-abstraction (xml-in-laml-abstraction f [parameter-validator! f-name language]) Generate a function with XML-in-LAML parameter passing rules, which passes its contents to the first parameter of f, and its attributes to the second parameter of f.
xml-in-laml-name-clashes xml-in-laml-name-clashes The list of names (symbols) which causes name clashes relative to the current set of languages in use.
xml-in-laml-parametrization (xml-in-laml-parametrization f parameter-mediator [parameter-validator! f-name language]) Generate a function with XML-in-LAML parameter passing rules which sends its input to an ordinary function, f, with positional parameters via a parameter mediator.
xml-in-laml-positional-abstraction (xml-in-laml-positional-abstraction n m f [parameter-validator! f-name language]) Generate a function with XML-in-LAML parameter passing rules, together with a number of required parameters before and after the XML-in-LAML parameters.
xml-link-checing xml-link-checing Defines the amount of link checing that is to be carried out by LAML.
xml-modify-element (xml-modify-element element . attributes-and-contents) Bind some attributes content elements of element (the first parameter) and return a new, 'modified element function'.
xml-modify-element-prepend (xml-modify-element-prepend element . attributes-and-contents) A function similar to xml-modify-element, but instead of appending attributes-and-contents to the actual parameters of the modified function, it prepends attributes-and-contents.
xml-navigator-of (xml-navigator-of language) Return the XML navigator structure of language.
xml-non-transliteration-elements-in (xml-non-transliteration-elements-in language) Return the list of element names, for which we do not carry out the character transliteration in language.
xml-pass-default-dtd-attributes-in? (xml-pass-default-dtd-attributes-in? language) Controls whether the default attribute values, as specified in the DTD, are passed explicitly as attribute values in every instance of the element.
xml-preformatted-text-elements-in (xml-preformatted-text-elements-in language) Return the list of element names, for which we consistenly render all white space content characters as given in the input.
xml-render (xml-render xml-clause [prolog epilog]) Render the xml-clause (an LAML AST) and return the rendered string.
xml-render-cdata-section (xml-render-cdata-section cdata-section) Render the cdata section with space in between the individual cdata text elements.
xml-render-processing-instruction (xml-render-processing-instruction pi) Render the processing instruction pi.
xml-render-xml-comment (xml-render-xml-comment xml-comment) Render the xml-comment with space in between the individual comment text elements.
xml-represent-white-space-in? (xml-represent-white-space-in? language) This value controls the representation of white space in the internal AST representation of a document.
xml-sort-superficially-tag-parameters (xml-sort-superficially-tag-parameters parameters tag-name [language]) Like xml-sort-tag-parameters, but collect the content contribution in a relatively raw surface form.
xml-sort-tag-parameters (xml-sort-tag-parameters parameters tag-name [language]) Separates parameters according to the mirror rules of LAML.
xml-transliterate-character-data-in? (xml-transliterate-character-data-in? language) Return if CDATA (Character data) is transformed through an HTML/XML character transformation table.
xml-validate-contents? xml-validate-contents? A boolean variable that controls the XML validation.


1 XML front matters and end matters stuff.
This section contains the XML declaration and other XML front matter stuff. In addition it holds the end-laml function.

standard-prolog
Form (standard-prolog [language])
Description The standard-prolog function as redefined for XML. It returns the xml-declaration, the document type declaration, and a copyright comment. The standard prolog is the document part before the document root element. A default version of the standard-prolog is found in laml.scm. The present function relies on another function, xml-document-type-declaration-in, which returns an appropriate document type declaration
See also Scheme source file standard-prolog
applied function xml-declaration
applied function xml-document-type-declaration-in
applied function copyright-clause

xml-declaration
Form (xml-declaration)
Description Return the xml declaration
See also Scheme source file xml-declaration

end-laml
Form (end-laml)
Description A redefinition of end-laml from the fundamental LAML library. This redefined function calls the function check-id-and-idref-attributes!, which reports on possible violations of ID and IDREF(S) attribute constraints. Calls the original end-laml function as the last action.
See also Scheme source file end-laml
original end-laml laml.scm
ID and IDREF check function check-id-and-idref-attributes!


2 XML-in-LAML processing parameters.
The variables and functions in this part control a number of general properties of XML-in-LAML processing. Some of these are generic for all XML-in-LAML languages; Others are specific to a single language. A number of the properties are related to the checking, validation, and error reporting of the XML mirror functions.

laml-internal-representation
Form laml-internal-representation
Description A variable that determines the internal representation used for XML-in-LAML. Possible values: laml and sxml. The value laml implies usage of the original LAML ASTs. The value sxml implies usage of the SXML list representation of XML. Use of the value sxml is still somewhat experimental. If the value of this variable is changed, the xml-in-laml library must be reloaded.
See also Scheme source file laml-internal-representation

xml-check-attributes?
Form xml-check-attributes?
Description A boolean variable which controls the checking of element attributes. If true, check the element attributes against the attributes as defined in the DTD file. This variable is generic and common for all XML-in-LAML languages. The default value is true.
See also Scheme source file xml-check-attributes?

xml-validate-contents?
Form xml-validate-contents?
Description A boolean variable that controls the XML validation. If true, do validate the generated XML document against the DTD. This variable is generic and common for all XML-in-LAML languages. The default value is true.
See also Scheme source file xml-validate-contents?

xml-link-checing
Form xml-link-checing
Description Defines the amount of link checing that is to be carried out by LAML. Possible values are none, relative-urls, absolute-urls, and all (symbols), none: No link checking is done at alle. relative-urls: Only relative urls are checked. absolute-urls: Only absolute urls are checked. This includes URLs that are formed relative to a given base-url. all: All urls are checked.
See also Scheme source file xml-link-checing

xml-check-language-overlap?
Form xml-check-language-overlap?
Description A boolean variable that controls the check of XML language overlap. If true, check that that no elements are used via ambiguous simple names. Quite naturally, this variable is generic and common for XML-in-LAML loaded at the same time.
See also Scheme source file xml-check-language-overlap?

xml-transliterate-character-data-in?
Form (xml-transliterate-character-data-in? language)
Description Return if CDATA (Character data) is transformed through an HTML/XML character transformation table. The value is boolean, and normally true.
See also Scheme source file xml-transliterate-character-data-in?
mutator set-xml-transliterate-character-data-in
transformation table laml.scm

set-xml-transliterate-character-data-in
Form (set-xml-transliterate-character-data-in language new-value)
Description Ask for transliteration of all CDATA characters via an HTML/XML character transformation table. new-value must be boolean.
Parameters language The name of the XML-in-LAML language - see the first few lines of relevant mirror library manuals - a symbol.
new-value A boolean value.
See also Scheme source file set-xml-transliterate-character-data-in
selector xml-transliterate-character-data-in?
table getter xml-char-transformation-table-in
table setter set-xml-char-transformation-table-in
exceptions xml-non-transliteration-elements-in
transformation table laml.scm
Note Consider macro implementation.

xml-char-transformation-table-in
Form (xml-char-transformation-table-in language)
Description Return the HTML/XML character transformation table used for language.
Returns A character transformation table.
See also Scheme source file xml-char-transformation-table-in
transformation table laml.scm
table setter set-xml-char-transformation-table-in
exceptions xml-non-transliteration-elements-in

set-xml-char-transformation-table-in
Form (set-xml-char-transformation-table-in language new-value)
Description Set the HTML/XML character transformation table used for language. The value must be a character transformation table.
Parameters language The name of the XML-in-LAML language - see the first few lines of relevant mirror library manuals - a symbol.
new-value A character transformation table.
See also Scheme source file set-xml-char-transformation-table-in
table getter xml-char-transformation-table-in
exceptions xml-non-transliteration-elements-in
transformation table laml.scm
Note Consider macro implementation.

xml-non-transliteration-elements-in
Form (xml-non-transliteration-elements-in language)
Description Return the list of element names, for which we do not carry out the character transliteration in language. In XHTML, the list typically include the elements style and script. The value is a list of strings. The value of this function is locked and bound at mirror generation time.
See also Scheme source file xml-non-transliteration-elements-in
transliteration xml-transliterate-character-data-in?

xml-preformatted-text-elements-in
Form (xml-preformatted-text-elements-in language)
Description Return the list of element names, for which we consistenly render all white space content characters as given in the input. In XHTML, the list typically include the pre element. The value is a list of strings. The value of this function is locked and bound at mirror generation time.
See also Scheme source file xml-preformatted-text-elements-in

xml-error-truncation-length
Form xml-error-truncation-length
Description How many characters of the validation error messages to be presented. If you want longer error messages, just increase the value of this variable. The default value is currently 130.
See also Scheme source file xml-error-truncation-length

xml-pass-default-dtd-attributes-in?
Form (xml-pass-default-dtd-attributes-in? language)
Description Controls whether the default attribute values, as specified in the DTD, are passed explicitly as attribute values in every instance of the element. The value is boolean, and normally false. A true value in most cases give problems relative to the XML attribute validation. The value of this function is locked and bound at mirror generation time.
See also Scheme source file xml-pass-default-dtd-attributes-in?
validation control xml-check-attributes?

xml-accept-only-string-valued-attributes-in?
Form (xml-accept-only-string-valued-attributes-in? language)
Description A boolean variable that controls how rigid LAML handles attribute values in language (first parameter). As the name indicates, the value controls if only string valued attributes are allowed in the language. If no language information is present (i.e., if the language parameter is #f) always return #t.
See also Scheme source file xml-accept-only-string-valued-attributes-in?
setter set-xml-accept-only-string-valued-attributes-in

set-xml-accept-only-string-valued-attributes-in
Form (set-xml-accept-only-string-valued-attributes-in language new-value)
Description Controls the handling of LAML attribute values in language. If new-value is true, LAML only accept string valued XML attribute. If new-value is false, LAML string converts whatever follows an attribute symbol. The value must be a boolean value. True is recommended.
Parameters language The name of the XML-in-LAML language - see the first few lines of relevant mirror library manuals - a symbol.
new-value A boolean value.
See also Scheme source file set-xml-accept-only-string-valued-attributes-in
getter xml-accept-only-string-valued-attributes-in?
Note Consider macro implementation.

xml-accept-extended-contents-in?
Form (xml-accept-extended-contents-in? language)
Description A boolean variable that controls how rigid LAML handles element contents items. If the value returned is #t, numbers and characters are accepted as element content items in addition to strings, ASTs, and character references. If no language information is present (i.e., if the language parameter is #f) always return #f.
See also Scheme source file xml-accept-extended-contents-in?
setter set-xml-accept-extended-contents-in

set-xml-accept-extended-contents-in
Form (set-xml-accept-extended-contents-in language new-value)
Description Controls the handling of LAML element contents items in language. If new-value is true, LAML accepts characters and numbers of contents items in addition to strings, ASTs and character references. If new-value is false, LAML only accept strings, ASTs, and character references as element contents items. The value must be a boolean value.
Parameters language The name of the XML-in-LAML language - see the first few lines of relevant mirror library manuals - a symbol.
new-value A boolean value.
See also Scheme source file set-xml-accept-extended-contents-in
getter xml-accept-extended-contents-in?

xml-document-type-declaration-in
Form (xml-document-type-declaration-in language)
Description Return the document type declaration of language. The empty string signals that no document type declaration is available. The value of this function is locked and bound at mirror generation time.
See also Scheme source file xml-document-type-declaration-in

xml-represent-white-space-in?
Form (xml-represent-white-space-in? language)
Description This value controls the representation of white space in the internal AST representation of a document. If true, white space markers are inserted. If false, a clean AST without any white space marking is produced. In some languages, white space handling is essential. This is the case in XHTML. In XML languages that are not related to presentation at all, white space handling is not relevant. The value of this function is locked and bound at mirror generation time.
See also Scheme source file xml-represent-white-space-in?

xml-duplicated-attribute-handling
Form (xml-duplicated-attribute-handling language)
Description This value controls the handling of attributes that occur more than once in an XML attribute list. If the function returns keep-all, the attribute list is not affected at all; All attributes are passed. If the function returns keep-first, only the first attribute name/value pair is passed for further processing. If the function returns keep-last, only the last attribute name/value pair is passed for further processing. The value of this function is locked and bound at mirror generation time.
Returns either keep-all, keep-first, keep-last (a symbol)
See also Scheme source file xml-duplicated-attribute-handling

set-xml-link-checking-functions
Form (set-xml-link-checking-functions xml-language url-extractor-function base-url-extractor-function)
Description Register url-extractor-function and base-url-extractor-function in the XML link checking map of xml-language. The XML link checking map maps an XML language name to a list of two functions: url-extractor-function base-url-extractor-function. The url-extractor-function can be applied on an XML AST in order to deliver a list of URLs that appear in that language. The base-url-extractor-function can also be applied on an XML AST. It delivers a possible base url (for use when resolving relative URLs) in it appears in the AST, of #f in no such base URL occurs.
See also Scheme source file set-xml-link-checking-functions

url-extractor-of-xml-language
Form (url-extractor-of-xml-language xml-language)
Description Return the registered url-extractor function of xml-language. The url-extractor function can be applied on an XML-ast and it delivers a list of URLs that occur in the AST.
See also Scheme source file url-extractor-of-xml-language

base-url-extractor-of-xml-language
Form (base-url-extractor-of-xml-language xml-language)
Description Return the registered base-url-extractor function of xml-language. The base-url-extractor function can be applied on an XML-ast and it delivers a possible base url (for use when resolving relative URLs) in the AST.
See also Scheme source file base-url-extractor-of-xml-language


3 Other Constants.

explicit-space
Form explicit-space
Description The explicit white space value, as used internally in ast. The default value is boolean #t.
See also Scheme source file explicit-space

explicit-space-suppress
Form explicit-space-suppress
Description The explicit white space suppress value. The default value is boolean #f.
See also Scheme source file explicit-space-suppress

_
Form _
Description The symbolic name of explicit white space suppress.
See also Scheme source file _

preferred-maximum-width
Form preferred-maximum-width
Description An integer that expresses the prefered maximum column width for pretty printed ouput.
See also Scheme source file preferred-maximum-width

indentation-delta
Form indentation-delta
Description An integer which gives the level of indentation for pretty printed output.
See also Scheme source file indentation-delta

xml-always-render-white-space?
Form xml-always-render-white-space?
Description Controls the rendering of white space in the textual contents. If #t, white space characters are rendered exactly as they are present in the textual content. If #f, white space is eliminated to the minimal amount when rendering. In normal use, always use #f. In situations where HTML formatting (especially PRE) is present as textual elements, it may be useful to use #t. In this context, notice the concept of preformatted text elements, as returned by the function xml-preformatted-text-elements-in.
See also Scheme source file xml-always-render-white-space?
relevant function xml-preformatted-text-elements-in


4 AST constructors and basic selector selectors.
In this section we document the functions that work on abstract syntax trees (ASTs). More specifically, we describe the AST constructor function and the most basic functions that select a constituent of an AST. Abstract syntax trees make up the internal representation of XML documents in LAML. All XML mirror functions return abstract syntax trees, and as such they can be thought as convenient, high level AST constructors. Notice that the implementation of the functions in this section depend heavily on the value of the variable laml-internal-representation.

make-ast
Form (laml-make-ast element-name contents attributes kind language)
Description Make an AST given element-name, contents, a property list of attributes, a kind (single/double), and an XML language name. The parameter contents may be a list of subtrees. It may also be an element which satisfies either ast?, cdata? or forced-white-space?. In these cases, we embed the single element into a list. attributes is the list of attributes on property list format (such as '(a1 "v1" a2 "v2")). attribute names are always symbols, and attribute values are normally strings.
Parameters element-name A symbol or a string.
contents A list of contents in term of CDATA (strings), white space markers, or other ASTs.
attributes The attributes represented as a property list
kind The symbol double or single
language A symbol or string that represent the XML-in-LAML language name.
See also Scheme source file make-ast

ast-element-name
Form (ast-element-name ast)
Description Return the root element name of ast. The type of the returned value is a string.
Precondition ast is an abstract syntax tree that satisfies the ast? predicate
See also Scheme source file ast-element-name

ast-subtrees
Form (ast-subtrees ast)
Description Return the list of substrees of ast. This is also known as the contents of the ast. It is a list of CDATA (strings), ASTs, and white space markers.
Precondition ast is an abstract syntax tree that satisfies the ast? predicate
See also Scheme source file ast-subtrees
similar function ast-subtree

ast-attributes
Form (ast-attributes ast)
Description Return the list of attributes of the ast.
Precondition ast is an abstract syntax tree that satisfies the ast? predicate
Returns The list of attributes, as a property list.
See also Scheme source file ast-attributes
Relevant function get-prop
Relevant function defaulted-get-prop
high-level selector ast-attribute
high-order selector attribute-getter
Note The functions get-prop and defaulted-get-prop are useful for accessing the individual attribute values in the returned property list.

ast-kind
Form (ast-kind ast)
Description Return the kind of the ast. The type of the returned value is a symbol, either single or double. ASTs of type single are also known as empty elements. Tells whether the ast is to be rendered as a single or double tag.
Precondition ast is an abstract syntax tree that satisfies the ast? predicate
See also Scheme source file ast-kind

ast-language
Form (ast-language ast)
Description Return the language of the ast. The type of the returned value is a symbol.
Precondition ast is an abstract syntax tree that satisfies the ast? predicate
See also Scheme source file ast-language


5 High-level AST selector functions.
In this section we describe a set of more elaborate functions that access the constituents of an AST. In many contexts, the functions in this section are more convenient than the basic selector functions from the previous section.

ast-subtree
Form (ast-subtree ast el-name [n])
Description Return a specific subtree of ast, namely the n'th subtree with element-name el-name. If no such subtree exists, return #f. The first subtree of a given name counts as number 1 (not 0).
Precondition n > 0
Parameters ast The ast in which to locate a subtree
el-name The ast element name of a subtree of ast (string or symbol)
n The constituent number regarding el-name subtrees (an integer). Defaults to 1.
Returns A subtree of AST (if located) or #f
See also Scheme source file ast-subtree
basic selector ast-subtrees
generalized accessors traverse-and-collect-all-from-ast traverse-and-collect-first-from-ast

ast-attribute
Form (ast-attribute ast name [default-attribute-value])
Description Return the value of the attribute name in ast. Only attributes of ast are considered. This function is a convenient shortcut of (defauted-get-prop name (ast-attributes ast) default-value). The optional parameter serves as the attribute value in case no name attribute is found in the attribute list of ast.
Parameters ast An AST.
name The name of an attribute (a symbol).
default-attribute-value The default value, used if no attribute of name is found. A string.
See also Scheme source file ast-attribute
basic selector ast-attributes
related function unique-ast-attribute

attribute-getter
Form (attribute-getter attribute-name [default-value])
Description A higher-order function which returns an attribute getter function on ASTs. The returned function takes an AST as parameter.
Parameters attribute-name the attribute name - a symbol.
default-value the default value returned if there is no attribute named attribute-name in the attribute-list.
See also Scheme source file attribute-getter
lower-order function ast-attribute

ast-text
Form (ast-text ast)
Description Return a string of the aggregated CDATA contents of ast. White space markers are taken into account, but ast subtrees of ast do not contribute in this aggregation.
Returns The immediate aggregated textual contents of ast. Returns the empty string, in case there is no contents.
See also Scheme source file ast-text

ast-text-deep
Form (ast-text-deep ast)
Description Return a string of the aggregated CDATA contents of ast. Ast subtrees of ast contribute recursively in this aggregation. White space markers are also taken into account.
Returns The full aggregated textual contents of ast. Returns the empty string, in case there is no contents.
See also Scheme source file ast-text-deep


6 XML-in-LAML predicates.
The functions in this section are predicates that work on ASTs and their constituents.

ast?
Form (ast? x)
Description Is the parameter x an AST.
See also Scheme source file ast?

ast-strong?
Form (ast-strong? x)
Description Is the parameter x an AST in a stronger interpretation than ast? Using the native LAML representation, ast-strong? and ast? are identical. Using the SXML representation, (ast-strong? T) requires that the tree T has attribute and aux information. This corresponds to the 3. normal form of SXML. The strong predicate is used during the interpretation of parameters to the mirror functions. Rationale: If the weak ast predicate is used for interpretation of the mirror parameters, ambiguities will occur between lists of contents/attributes and AST structures.
See also Scheme source file ast-strong?

cdata?
Form (cdata? x)
Description Is the parameter x CDATA
See also Scheme source file cdata?

contents-data?
Form (contents-data? x [language])
Description Is the parameter x a contents element item. In other words, is x either an ast, a character reference, or a string. If the optional language parameter is passed, and if this language accepts extended contents, also numbers and characters are considered as contents data.
See also Scheme source file contents-data?

contents-data-strong?
Form (contents-data-strong? x [language])
Description Is the parameter x a contents element item, with ASTs recognized in the strong form (using ast-strong?)
See also Scheme source file contents-data-strong?
strong ASTs ast-strong?

char-ref?
Form (char-ref? x)
Description Is x a character reference.
See also Scheme source file char-ref?

forced-white-space?
Form (forced-white-space? x)
Description Is the parameter x a white space mark.
See also Scheme source file forced-white-space?

white-space-suppress?
Form (white-space-suppress? x)
Description Is the parameter x a white suppress space mark.
See also Scheme source file white-space-suppress?

white-space-related?
Form (white-space-related? x)
Description Is the parameter x white space related?
See also Scheme source file white-space-related?

terminal-ast-node?
Form (terminal-ast-node? x)
Description Is x an ast nodes without subtrees?
See also Scheme source file terminal-ast-node?

xml-comment?
Form (xml-comment? x)
Description Is x an XML comment?
See also Scheme source file xml-comment?

cdata-section?
Form (cdata-section? x)
Description Is x an XML CDATA section?
See also Scheme source file cdata-section?

processing-instruction?
Form (processing-instruction? x)
Description Is x an XML processing instruction?
See also Scheme source file processing-instruction?

ast-of-type?
Form (ast-of-type? type name)
Description A higher-order function that returns an AST predicate, which checks if the type of the AST is name. The type is either element-name, kind, or language (a symbol). The resulting predicate may be applied on both ASTs and non-ASTs. If applied on a non-AST, the predicate always returns false. If type is the symbol element-name, the generated predicate checks if a given AST has that element name at top level. If type is the symbol kind, the generated predicate checks if a given AST is either double or single. If type is the symbol language, the generated predicate checks if a given AST belongs to the language.
Parameters type One of the symbols element-name, kind, or language.
name The element-name, the kind-name (double or single), or the language-name, depending on the value of the parameter type. A string.
Returns A specialized AST predicate.
See also Scheme source file ast-of-type?


7 Character entities.
The function char-ref returns a character-reference. In XML, character references are used to denote characters which are not directly accessible from normal input devices. Notice that the predicated char-ref? is located in the AST predicate section.

char-ref
Form (char-ref x)
Description Return a character reference value for x. The parameter may be a positive, decimal integer or a symbolic name (string or symbol), such as amp, gt, or lt. Character references are represented internally as an appropriate list structure, similar to an AST list structure. In xml-render, these structures are converted to XML's character notation. With this we avoid a conflict with character transformation using the HTML transformation tables.
See also Scheme source file char-ref

char-ref-value
Form (char-ref-value char-ref-structure)
Description Return the number or symbol of char-ref-structure.
See also Scheme source file char-ref-value


8 XML Comments.
The xml-comment form documented below allows for native XML comments in an XML-in-LAML document. Use the xml-comment form if it is important for you that LAML outputs native XML comments. In other cases, you may use Scheme comments in your LAML document. XML comments are not rendered if they occur in empty elements.

xml-comment
Form (xml-comment . comment-text-list)
Description Construct an XML comment and return it. This function accepts a list of comment text elements, which together form the aggregated comment text. In this context, a comment text element is a string, or a value which can be converted to a string via use of the function as-string.
Precondition The substring "--" does not occur as part of a comment text element.
See also Scheme source file xml-comment

xml-comment-contents
Form (xml-comment-contents xml-comment)
Description Return the comment text of an XML comment.
Returns a list of strings.
See also Scheme source file xml-comment-contents

xml-render-xml-comment
Form (xml-render-xml-comment xml-comment)
Description Render the xml-comment with space in between the individual comment text elements.
Returns The rendered string.
See also Scheme source file xml-render-xml-comment


9 XML CDATA Sections.
CDATA sections are typically used in script and style elements, to protect the characters '<', '>', and others. Most browsers do not render CDATA sections, if they appear within the textual contents.

cdata-section
Form (cdata-section . cdata-text-list)
Description Construct an XML CDATA section and return it. This function accepts a list of comment text elements, which together form the aggregated CDATA section text. In this context, a CDATA text element is a string, or a value which can be converted to a string via use of the function as-string.
Precondition The substring "]]>" does not occur as part of a CDATA text element.
See also Scheme source file cdata-section

cdata-section-contents
Form (cdata-section-contents cdata-section)
Description Return the cdata text of an XML comment.
Returns a list of strings.
See also Scheme source file cdata-section-contents

xml-render-cdata-section
Form (xml-render-cdata-section cdata-section)
Description Render the cdata section with space in between the individual cdata text elements.
Returns The rendered string.
See also Scheme source file xml-render-cdata-section


10 XML Processing Instructions.
A processing instruction is an XML technicality for telling something to an application, which processes the document. Processing instructions are only rendered if they occur in non-empty elements.

processing-instruction
Form (processing-instruction pi-target . text-list)
Description Construct an XML processing instruction and return it. This function accepts a pitarget and a list of text elements. In this context, text element is a string, or a value which can be converted to a string via use of the function as-string.
Precondition The substring "?>" does not occur as part of a CDATA text element. The pi-target is not "XML" (using upper or lower cases).
Parameters pi-target A name used to identify the application, towards which the instruction is targeted.
text-list Additional text (a list)
See also Scheme source file processing-instruction

processing-instruction-target
Form (processing-instruction-target pi)
Description Return the processing instruction pi-target of the processing instruction pi.
Returns a text string.
See also Scheme source file processing-instruction-target

processing-instruction-contents
Form (processing-instruction-contents pi)
Description Return the processing instruction text part of the processing instruction pi.
Returns a list of strings.
See also Scheme source file processing-instruction-contents

xml-render-processing-instruction
Form (xml-render-processing-instruction pi)
Description Render the processing instruction pi.
Returns The rendered string.
See also Scheme source file xml-render-processing-instruction


11 XML language bookkeeping.
XML-in-LAML keeps track of the XML-in-LAML languages in use, and it will warn you if an ambiguously named mirror function is used. The boolean variable xml-check-language-overlap? can be used to control the reporting of language overlaps (use of ambiguous mirror functions.)

Each XML language has a name when used in LAML. The names of all loaded mirrors is returned by the parameter-less function languages-in-use. If N is the name of an XML-in-LAML language, (N 'el-name) returns the mirror function named el-name in N.

A language map is an association list that maps mirror function names to the mirror functions. Via use of a language map, it is always possible to acces a mirror function independt of name clashes with other XML language mirrors.


xml-in-laml-name-clashes
Form xml-in-laml-name-clashes
Description The list of names (symbols) which causes name clashes relative to the current set of languages in use. Assigned by register-xml-in-laml-language. Thus, this variable is always up-to-date in between registrations of languages. Be careful not to redefine this variable by double loading this file.
See also Scheme source file xml-in-laml-name-clashes

register-xml-in-laml-language
Form (register-xml-in-laml-language language language-map)
Description Register that language (the first parameter) is an XML language in use in the current LAML session. This function is called by the mirror function libraries. The first parameter, language, is a symbol. The second parameter, language-map, is the language map of the language. As a precondition it is assumed that we do not register the same language more than once.
See also Scheme source file register-xml-in-laml-language

language-map-of
Form (language-map-of language)
Description Return the language map of language. If language is not registered via register-xml-in-laml-language, return #f. The parameter language is a symbol.
See also Scheme source file language-map-of

language-in-use?
Form (language-in-use? language)
Description Is language in use - is it registered as an xml-in-laml language?
See also Scheme source file language-in-use?

languages-in-use
Form (languages-in-use)
Description Return the list of language in used, as registered by register-xml-in-laml-language.
See also Scheme source file languages-in-use

element-names-of-language
Form (element-names-of-language language)
Description Return the element names of language, as defined by its language map.
See also Scheme source file element-names-of-language

causes-xml-in-laml-name-clash?
Form (causes-xml-in-laml-name-clash? name)
Description Is name involved in a name clash among the registered xml-in-laml languages?
See also Scheme source file causes-xml-in-laml-name-clash?

activator-via-language-map
Form (activator-via-language-map language)
Description Return an activator function for language.
Parameters language The name of an XML language (a symbol).
Returns A function which given an XML element name (a string or a symbol) in language returns the appropriate mirror function.
See also Scheme source file activator-via-language-map

with-xml-language
Form (with-xml-languge language-name . forms)
Description A macro which globally establishes the name bindings of xml-language and evaluate forms in this state. Does also handle separate checking of ID and IDREF attributes in forms. Works in a manner similar to a fluid-let. As a matter of optimization, only assign the names in the overlap between the XML languages in use. Defined as a syntactical abstraction.
Parameters language-name The name of a language map (a symbol).
forms A number of Scheme forms presumably involving mirror function names from the XML language language-name.
Returns The value of the last expression in forms
See also Scheme source file with-xml-language
similar function with-xml-language!
Note If the overlap between the XML languages in use includes central Scheme functions, such as map or filter, you should use with-xml-language! instead (and put the central Scheme functions in the minus-elements).

with-xml-language!
Form (with-xml-languge! language-name minus-elements . forms)
Description A macro which globally establishes the name bindings of xml-language and evaluate forms in this state. Does also handle separate checking of ID and IDREF attributes in forms. Works in a manner similar to a fluid-let. All elements of xml-language are redefined, except the explictly given minus elements.
Parameters language-name The name of a language map (a symbol).
minus-elements The list of element names which are not allowed to be reassigned.
forms A number of Scheme forms presumably involving mirror function names from the XML language language-name.
Returns The value of the last expression in forms
See also Scheme source file with-xml-language!
similar function with-xml-language


12 The language map.
The language map is a mapping that allows us to access the element mirror functions independent of any name clash. In this version of LAML the language map is an association that maps element names (symbols) to function objects. In the longer run, it should be a more efficient search structure.

get-mirror-function
Form (get-mirror-function language-map element-name)
Description Return the mirror function based on element-name from language map.
Parameters element-name The name an XML element. Either a symbol or a string.
Returns The mirror function or #f if no mirror function exists in the map.
See also Scheme source file get-mirror-function

put-mirror-function
Form (put-mirror-function language-map element-name mirror-function)
Description Update the language map by the association of element-name and mirror function. Returns the updated map. The parameter element-name is either a symbol or a string. Causes an error if there already is an entry for element-name
See also Scheme source file put-mirror-function


13 XML navigation information.
XML navigation information provides for "smart searching" of XML ASTs. The smartness is based on the following knowledge: (1) The possible direct and indirect sub-elements of a given element. (2) The possible attributes of an element and its direct and indirect sub-elements. This information is pre-computed in the XML-in-LAML mirror generation tool. The functions in this section provides access to this pre-computed information. Notice that the functions in this section Return static information, as derived from the DTD.

register-xml-in-laml-navigator
Form (register-xml-in-laml-navigator language navigator-structure)
Description Register navigator-structure and an XML-in-LAML navigator for language. This function is called "automatically" when the mirror functions are loaded.
See also Scheme source file register-xml-in-laml-navigator

xml-navigator-of
Form (xml-navigator-of language)
Description Return the XML navigator structure of language. If language is not registered via register-xml-in-laml-language, return #f. The parameter language is a symbol.
See also Scheme source file xml-navigator-of

possible-elements-rooted-by-element
Form (possible-elements-rooted-by-element element-name language)
Description Return a list of element names that can appear as direct or indirect constituents of an AST rooted by element-name. Reflexively, element-name will always be returned as part of the result.
Precondition language is a registered XML language in the enclosing LAML session, and element-name is an existing name of an element in language.
Returns The list of possible elements names (a list of symbols). The list is sorted alphabetically.
See also Scheme source file possible-elements-rooted-by-element

possible-attributes-rooted-by-element
Form (possible-attributes-rooted-by-element element-name language)
Description Return a list of attribute names that can appear as direct or indirect constituents of an AST rooted by element-name. Reflexively, the attributes of element-names are always parts of the result.
Precondition language is a registered XML language in the enclosing LAML session, and element-name is an existing name of an element in language.
Returns The list of possible attribute names (a list of symbols). The list is sorted alphabetically.
See also Scheme source file possible-attributes-rooted-by-element

can-have-element-constituent?
Form (can-have-element-constituent? ast el-name)
Description Can ast have a direct or indirect constituent (sub-ast) with element name el-name. The result is always true if (ast-element-name ast) equals to el-name.
Parameters ast An AST
el-name is the name of an element in the language of ast (a string or a symbol).
See also Scheme source file can-have-element-constituent?


14 Mirror generation functions.
The functions in this sections are the important and 'heavy' mirror generation functions.

xml-sort-tag-parameters
Form (xml-sort-tag-parameters parameters tag-name [language])
Description Separates parameters according to the mirror rules of LAML. In other words, this is the function which implements the central LAML mirror function rules. Returns a cons cell of contents and attributes. Attributes are returned in property list format. Contents are returned as a list contents elements (strings, ASTs, booleans).
See also Scheme source file xml-sort-tag-parameters
similar function xml-sort-superficially-tag-parameters

xml-sort-superficially-tag-parameters
Form (xml-sort-superficially-tag-parameters parameters tag-name [language])
Description Like xml-sort-tag-parameters, but collect the content contribution in a relatively raw surface form. Handle attributes in the same way as xml-sort-tag-parameters. As a contrast to xml-sort-tag-parameters, white space related values are passed unchanged by this funnction. Use this kind of 'sorting' to obtain XML-in-LAML parameter passing in abstractions, which transfer data to XML-in-LAML mirror functions (which in turn use xml-sort-tag-parameters).
See also Scheme source file xml-sort-superficially-tag-parameters
similar function xml-sort-tag-parameters

laml-source-prepare
Form (laml-source-prepare laml-lst)
Description Prepare laml-list to be used as input to a mirror function. This function is useful when the result of transform-ast-list is passed as input to a XML mirror function. Elimiate forced-white-space markers, and introduce explict-space-suppres when necessary.
See also Scheme source file laml-source-prepare
in relation to transform-ast-list

generate-xml-mirror-function
Form (generate-xml-mirror-function validation-procedure tag-name default-dtd-attributes single-double-kind language overlap-check? action-procedure)
Description Return an XML mirror surface function, in which textual content parameters and attribute value pairs can be given in a very liberal fashion.
Parameters validation-procedure the procedure that validates all aspects of the application of the element mirror function.
tag-name a string which represents the name of the tag (used for error message purposes).
default-dtd-attributes an alist of attribute key value pairs, as specified in the DTD.
single-double-kind either the symbol single, double or possible-single.
language the language in use (a symbol).
overlap-check? controls whether to check for name clashes in between the registered XML-in-LAML languages.
action-procedure serves both as a boolean and a procedure. If #f, no action procedure is supplied. If #t, an action procedure exists. If a procedure, it is the action procedure.
See also Scheme source file generate-xml-mirror-function


15 Contents validation.
The definitions in this section carry out the content validation.

validate-contents-by-dfa!
Form (validate-contents-by-dfa! contents dfa tag-name)
Description Apply the deterministic finte state automaton dfa on contents. If contents is not accepted call xml-check-error for an appropriate reporting of the validation error.
Parameters contents A list of content items, such as strings, ASTs and white space markers.
dfa A deterministic final state automation which controls the acceptance.
tag-name The name of the element - used for error message purposes.
See also Scheme source file validate-contents-by-dfa!

validate-as-pcdata!
Form (validate-as-pcdata! contents tag-name)
Description Validate that contents is pure PCDATA.
Parameters contents A list of content items, such as strings, ASTs and white space markers.
tag-name The name of the element - used for error message purposes.
See also Scheme source file validate-as-pcdata!

validate-mixed-contents-by-simple-means!
Form (validate-mixed-contents-by-simple-means! contents symbol-choice-list tag-name)
Description Validate that contents corresponds to mixed contents. Mixed contents includes PCDATA a number of other choices in a 'zero-or-more' structure. It means that it is PCDATA or one of a number of possible ASTs.
Parameters contents A list of content items, such as strings, ASTs or white space markers.
tag-name The name of the element in which we check the constituents.
symbol-choice-list A list of symbols for the possible choices - a list of symbols.
See also Scheme source file validate-mixed-contents-by-simple-means!

extraordinary-allow-element?
Form (extraordinary-allow-element? element-name context-element-name)
Description Is element-name extraordinarily allowed within context-element-name (both symbols). By redefining this function you may extraordinarily allow element-name to appear within context-element-name. By default, this function always returns the value #f (false).
See also Scheme source file extraordinary-allow-element?


16 Attribute checking.
The definitions in this section is used by the validation procedures, which are specific for each supported XML language. Current status of attribute checking: From LAML version 27: The constrains regarding ID, IDREF, and IDREFS are now handled. See the function check-id-and-idref-attributes!. NotationTypes are not dealt with - mostly because I have never encountered them, so the motivation to program check for this special enumeration type is not high. The #FIXED default keyword is present in the parsed DTD information, but we do not carry out any check against it (which is: If the attribute is given it must have the fixed default value). The attribute value normalization called for in section 3.3.3 of the XML specificaiton is not done either. Attribute duplication is checked for, as well as presence of angle characters in attribute values.

xml-check-attributes!
Form (xml-check-attributes! attributes dtd-attribute-definition number-of-req-attributes tag-name)
Description Check the attributes (first par) in the calling form against the attribute definitions taken from the DTD file (second par). The first parameter, attribute, is the attributes of the calling form, on property list form: (a1 v1 ... an vn). ai is a symbol and vi is a string. The second parameter dtd-attribute-definition is the attributes as defined in the dtd for the element in question. The third parameter number-of-req-attributes is the number of required attributes in dtd-attr-definitions. It happens to be the case that all the required attributes are located in the front of dtd-attribute-definition. The fourth parameter, tag-name, is the name of the enclosing tag. dtd-attribute-definition is a list of triples (attr-name attr-type require-status). attr-name is a string, attr-type is a string or a list of strings (possibilities), and require-status is a string such as "#IMPLIED" or "#REQUIRED"
See also Scheme source file xml-check-attributes!

check-id-and-idref-attributes!
Form (check-id-and-idref-attributes!)
Description Check that the ID and IDREF attribute values are used according to the XML 1.0 specification. This function is called by the end-laml function, as redefined in this library (lib/xml-in-laml/xml-in-laml.scm). You may also chose to call this function yourself, as part of the processing of your XML document. This procedure resets the variables bookkeeping of ID and IDREF attribute checking such that if the procedure is called again it will not report the same errors again.
See also Scheme source file check-id-and-idref-attributes!


17 Link checking.
Web documents are able to link to other web documents. As an example, in XHTML the href attribute of the a element represents such a link. The procedures in this section are used to check that links actually addresse existing resources.

collect-links-for-later-checking-in-ast!
Form (collect-links-for-later-checking-in-ast! xml-ast absolute-target-html-file)
Description Collect the urls in xml-ast, which are about to be written to the file absolute-target-html-file (full path). The urls are collected for later checking in the global variables relative-url-list-for-later-checking and absolute-url-list-for-later-checking.
See also Scheme source file collect-links-for-later-checking-in-ast!

check-relative-url-lists
Form (check-relative-url-lists relative-urls absolute-urls)
Description Checks the existense of the resources addressed by the urls in relative-urls
See also Scheme source file check-relative-url-lists

check-absolute-url-lists
Form (check-absolute-url-lists relative-urls absolute-urls)
Description Checks the existense of the resources addressed by the urls in absoute-urls
See also Scheme source file check-absolute-url-lists


18 XML warning procedures.

display-xml-warning
Form (display-xml-warning . messages)
Description A variant of display-warning which prefixes the warning text with a 'XML Warning' prefix.
See also Scheme source file display-xml-warning

xml-check-error
Form (xml-check-error . messages)
Description The procedure that reports XML validation errors. The default is display-xml-warning, which issues non-fatal warning messages. As an alternative you can use laml-error which provides for fatal error messaging. Both of these accept an arbitrary number of parameters, which are string converted prior to string appending them.
See also Scheme source file xml-check-error
default value display-xml-warning
alternative value laml-error


19 Rendering functions and procedures.
The functions and procedures in this section transform the internal document representation (abstract syntax trees) to a textual form (text strings).

render-to-output-port
Form (render-to-output xml-clause output-port [prolog epilog])
Description Render the XML clause (an AST) to output-port. output-port is assumed to be open. output-port will not be closed by this procedure.
Parameters xml-clause an AST
output-port an open output port
prolog The symbol prolog, in which case (standard-prolog) is inserted, or a prolog string to be inserted
epilog The symbol epilog in which case (standard-epilog) is inserted, or a epilog string to be inserted
See also Scheme source file render-to-output-port
standard-prolog laml.scm
standard-epilog laml.scm

pretty-render-to-output-port
Form (pretty-render-to-output-port xml-clause output-port [prolog epilog])
Description Pretty print the XML clause (an AST) to output-port. output-port is assumed to be open. output-port will not be closed by this procedure. The constants preferred-maximum-width and indentation-delta affect the pretty printing.
Parameters xml-clause an AST
output-port an open output port
prolog The symbol prolog, in which case (standard-prolog) is inserted, or a prolog string to be inserted
epilog The symbol epilog in which case (standard-epilog) is inserted, or a epilog string to be inserted
See also Scheme source file pretty-render-to-output-port
standard-prolog laml.scm
standard-epilog laml.scm

render-start-tag-to-output-port
Form (render-start-tag-to-output-port xml-clause output-port)
Description Render the start-tag of xml-clause (an LAML AST) to output-port. With this function, only the start tag and the attributes of the top-level element is rendered to the port. This function is primarily useful for stepwise imperative processing of an XML document.
Parameters xml-clause an AST
output-port an open output port
See also Scheme source file render-start-tag-to-output-port

render-end-tag-to-output-port
Form (render-end-tag-to-output-port xml-clause output-port)
Description Render the end-tag of xml-clause (an LAML AST) and return the rendered string. With this function, only the end tag of the top-level element is rendered to the port. This function is primarily useful for stepwise imperative processing of an XML document.
Parameters xml-clause an AST
output-port an open output port
See also Scheme source file render-end-tag-to-output-port

xml-render
Form (xml-render xml-clause [prolog epilog])
Description Render the xml-clause (an LAML AST) and return the rendered string. In this context, rendering means linearization of the AST to its textual form.
Parameters xml-clause an AST
prolog The symbol prolog, in which case (standard-prolog) is inserted, or a prolog string to be inserted
epilog The symbol epilog in which case (standard-epilog) is inserted, or a epilog string to be inserted
See also Scheme source file xml-render

pretty-xml-render
Form (pretty-xml-render xml-clause [prolog epilog])
Description Pretty print xml-clause (an LAML AST) and return the rendered string. In this context, rendering means linearization of the AST to its textual, pretty printed form. The constants preferred-maximum-width and indentation-delta affect the pretty printing.
Parameters xml-clause an AST
prolog The symbol prolog, in which case (standard-prolog) is inserted, or a prolog string to be inserted
epilog The symbol epilog in which case (standard-epilog) is inserted, or a epilog string to be inserted
See also Scheme source file pretty-xml-render

start-tag-of
Form (start-tag-of xml-clause)
Description Render the start-tag of xml-clause (an LAML AST) and return the rendered string. With this function, only the start tag and the attributes of the top-level element is rendered and returned. This function is primarily useful for stepwise imperative processing of an XML document.
See also Scheme source file start-tag-of

end-tag-of
Form (end-tag-of xml-clause)
Description Render the end-tag of xml-clause (an LAML AST) and return the rendered string. With this function, only the end tag of the top-level element is rendered and returned. This function is primarily useful for stepwise imperative processing of an XML document.
See also Scheme source file end-tag-of


20 Element related functions.
This section contains (mostly) higher-order functions that are related to the mirrors of the XML elements.

xml-modify-element
Form (xml-modify-element element . attributes-and-contents)
Description Bind some attributes content elements of element (the first parameter) and return a new, 'modified element function'. With this, some attributes and some content elements are pre-bound to certain values in the modified element. The parameter attributes-and-contents is of the same form as the parameters to a LAML surface mirror functions. In fact, attributes-and-contents is appended to the actual parameters, which are passed to the modified element function.
Returns an attribute-modified mirror function
Example
(define a-main (modify-element a 'target "main"))
See also Scheme source file xml-modify-element
similar function xml-modify-element-prepend

xml-modify-element-prepend
Form (xml-modify-element-prepend element . attributes-and-contents)
Description A function similar to xml-modify-element, but instead of appending attributes-and-contents to the actual parameters of the modified function, it prepends attributes-and-contents.
See also Scheme source file xml-modify-element-prepend
similar function xml-modify-element


21 XML in LAML parametrization and abstraction functions.
The functions in this category are higher-order functions which generate functions that obey XML-in-LAML parameter passing rules. In other words, the function that are generated use the same parameter conventions as the mirror functions of the HTML and XML elements.

xml-in-laml-parametrization
Form (xml-in-laml-parametrization f parameter-mediator [parameter-validator! f-name language])
Description Generate a function with XML-in-LAML parameter passing rules which sends its input to an ordinary function, f, with positional parameters via a parameter mediator. The first parameter, f, is typically a web-related function with positional parameter correspondence (such as an existing, old-style 'conveninece function'). The parameter parameter-mediator is a function that generates a parameter list for f from content-list and the attributes property list, which is produced by the function xml-sort-tag-parameters. Thus, the parameter-mediator function translates the 'new parameter profile' to the 'old one', which is associated with f. The optional procedure parameter-validator! validates the contents-list and the attribute-list by reporting problems via xml-check-error. The optional f-name parameter is a string corresponding to the name of f (used for error message purposes only).
Parameters f An 'old style' fuction web function with positional parameters. Is applied on the result of parameter-mediator.
parameter-mediator a function of two parameters (contents-list and attribute property list) which transforms the new style parameters to the old style. f is applied on the output of parameter-mediator!
parameter-validator! a procedure of two parameters (contents-list and attribute property list) which validates the input of the generated function.
f-name The name of the generated function. Solely used for error message purposes.
language The name of the XML language to which the generated xml-in-laml parametrization belongs.
See also Scheme source file xml-in-laml-parametrization
applied function xml-sort-tag-parameters
similar function xml-in-laml-abstraction
useful par. validator required-implied-attributes
LAML tutorial Web authoring with higher-order functions
Note See the LAML tutorial referenced above for additional discussion and examples.

xml-in-laml-abstraction
Form (xml-in-laml-abstraction f [parameter-validator! f-name language])
Description Generate a function with XML-in-LAML parameter passing rules, which passes its contents to the first parameter of f, and its attributes to the second parameter of f. The function f can call and XML-in-LAML mirror function, or another XML-in-LAML abstraction.
Parameters f A transformer function of two parameters - contents and the attribute property list. The generated function returns the value of f applied on contents and attributes.
parameter-validator! A checking procedure of two parameters - contents and the attribute property list. Must report errors explicitly by xml-check-error.
f-name The name of the abstraction - used for error message purposes only.
language The name of the XML language to which the generated xml-in-laml abstraction belongs.
See also Scheme source file xml-in-laml-abstraction
internally applied function xml-sort-superficially-tag-parameters
similar function xml-in-laml-parametrization
generalized function xml-in-laml-positional-abstraction
useful par. validator required-implied-attributes
LAML tutorial Web authoring with higher-order functions
Note See the LAML tutorial referenced above for additional discussion and examples.

xml-in-laml-positional-abstraction
Form (xml-in-laml-positional-abstraction n m f [parameter-validator! f-name language])
Description Generate a function with XML-in-LAML parameter passing rules, together with a number of required parameters before and after the XML-in-LAML parameters.
Precondition n + m is less than or equal to the length of parameterlist of the generated function. (Condition checked by this function).
Parameters n The number of positional parameters before the XML-in-LAML parameter section.
m The number of positional parameters after the XML-in-LAML parameter section.
f A transformer function of n + 2 + m parameters. The two parameters in the middle are the contents and the attributes. The generated function returns the value of f applied on contents and attributes together with the positional parameters.
parameter-validator! A checking procedure of two parameters - contents and the attribute property list. Must report errors explicitly by xml-check-error. Cannot validate the positional parameters.
f-name The name of the abstraction - used for error message purposes only.
language The name of the XML language to which the generated xml-in-laml abstraction belongs.
See also Scheme source file xml-in-laml-positional-abstraction
specialized function xml-in-laml-abstraction
useful par. validator required-implied-attributes

required-implied-attributes
Form (required-implied-attributes required-attribute-names implied-attribute-names [tag-name])
Description A higher-order function which returns an attribute checker. Report problems via xml-check-error. Check that all required-attribute-names are present and that the actual attributes are covered by required-attribute-names and implied-attribute-names together. The generated functions can be used as parameter valdiator procedures in xml-in-laml-abstraction and xml-in-laml-parametrization
Parameters required-attribute-names A list of attribute names (symbols) which are required.
implied-attribute-names A list of additional attribute names (symbols) which are allowed, or the list (*) - a singleton list with the symbol * - in the meaning of any attribute.
See also Scheme source file required-implied-attributes
relevant context of use xml-in-laml-abstraction xml-in-laml-parametrization
error function xml-check-error


22 AST traversal and AST transformation functions.
The AST traversal functions extract information from AST by means of traversal and searching. The "find" functions use guided search, aided by the XML navigation information which is derived from the XML DTD. The "traverse-and-collect" functions are slightly more general (with a node-interesting? predicate), but they do not (and cannot) make use of the XML navigation information. Thus, these function do an exhaustive search.

find-asts
Form (find-asts ast el-name [ast-transformer])
Description Find and return a list of transformed sub ASTs of ast (first parameter) each with a root element of name el-name. The search is guided by the XML navigation information, hereby pruning the tree traversal. The AST is traversed in pre-order. The transformation of the resulting sub-ASTS is done by the optional ast-transformer. If a sub-ast is returned as a part of the result then the sub-ast is not searched internally for recursive matches.
Parameters ast An AST.
el-name A name of an element in the language of ast (a string or symbol).
ast-transformer An optional AST transformation function, which defaults to the identity function id-1.
Returns A list of transformed ASTs.
See also Scheme source file find-asts
similar function traverse-and-collect-all-from-ast traverse-and-collect-first-from-ast find-first-ast
related functions traverse-and-collect-first-from-ast find-first-ast

find-first-ast
Form (find-first-ast ast el-name [ast-transformer])
Description Find and return a sub-AST of ast (first parameter) with a root element of name el-name. The search is guided by the XML navigation information, hereby pruning the tree traversal. The AST is traversed in pre-order. When an appropriate sub-AST is found, the search is terminated. The transformation of the resulting sub-ASTS is done by the optional ast-transformer.
Parameters ast An AST.
el-name A name of an element in the language of ast (a string or symbol).
ast-transformer An optional AST transformation function, which defaults to the identity function id-1.
Returns A transformed AST, or #f
See also Scheme source file find-first-ast
similar function traverse-and-collect-first-from-ast
related functions traverse-and-collect-all-from-ast find-asts

unique-ast-attribute
Form (unique-ast-attribute ast name [default-attribute-value])
Description Return the value of the attribute name in ast, or in one of the subtrees of ast. If, from a static consideration, the attribute is not unique in ast, a fatal error occurs. The default attribute value is only applied if the attribute could occur, but if it does NOT in the actual AST. This function is useful for extraction of deep attributes given the fact that they only can occur once in the document, according to both the actual document structure and the statically extracted XML navigation information. The navigation towards a deep, unique attribute is efficient.
Precondition Statically, only one occurence of attr-name can appear in ast.
Parameters ast The AST in which to look for the attribute
name The name of the attribute (symbol or string)
default-attribute-value The default value, used if no attribute of name is found, but only if it is allowed to occur. A string.
See also Scheme source file unique-ast-attribute
related function ast-attribute

traverse-and-collect-all-from-ast
Form (traverse-and-collect-all-from-ast ast-tree node-interesting? ast-transformer)
Description Traverse all nodes of the AST ast-tree, and return transformed subtrees that satisfy the node-interesting? predicate. No traversal takes place inside subtrees that sastify the node-interesting? predicate. The transformation of the interesting subtree is done with ast-transformer (the third parameter). Non-AST constituents of the AST (CDATA and white space markers) are not visited during the traversal. The traversal is done in pre-order.
Parameters ast-tree The AST to be traversed. May also be a content list (such as a list of ASTs) as returned by the function ast-subtrees.
node-interesting? The AST predicate that identifies the ASTs of interest.
ast-transformer The function which is applied on the ASTs identified by node-interesting?
Returns The mapping of the function ast-transformer on the list of interesting subtrees.
See also Scheme source file traverse-and-collect-all-from-ast
useful as parameter ast-of-type?
sibling function traverse-and-collect-first-from-ast
similar function find-asts
Note The higher-order function ast-of-type? generates useful node-interesting? functions.

traverse-and-collect-first-from-ast
Form (traverse-and-collect-first-from-ast ast-tree node-interesting? ast-transformer)
Description Traverse the AST ast-tree, and return a transformation of the first subtree which satisfies the predicate node-interesting. The transformation of the interesting subtree is done with ast-transformer (the third parameter). Non-AST constituents of the AST (CDATA and white space markers) are not visited during the traversal. The traversal is done in pre-order. Return #f in case no match is found. In fact, return the transformed AST, applying ast-transformer on the returned tree.
Parameters ast-tree The AST to be traversed. May also be a content list (such as a list of ASTs) as returned by the function ast-subtrees.
node-interesting? The AST predicate that identifies the ASTs of interest.
ast-transformer The function which is applied on the ASTs identified by node-interesting?
Returns (ast-transformer TR), where TR is the first encounted tree matched by node-interesting? or #f if no tree is matched.
See also Scheme source file traverse-and-collect-first-from-ast
useful as parameter ast-of-type?
sibling function traverse-and-collect-all-from-ast
similar function find-first-ast
Note The higher-order function ast-of-type? generates useful node-interesting? functions.

transform-ast-list
Form (transform-ast-list input-list . transform-specs)
Description Apply the transformation-specs on input-list and return a list of transformed input elements. This function can, for instance, be applied on the subtree list of an AST. A single transformation spec is a list of two element: A predicate and a transformation function. A transformation function is applied if the corresponding predicate holds on the input element. If no predicate holds on an input element, the input element is returned (not copied) without being transformed. No recursive transformations are done by this function.
Parameters input-list Each element in input-list can be an AST, a string, a character reference, or a white space related marker
transform-spec A list of transformation specifications, each of which is a list of length 2: (input-predicate transformation-function)
Returns A list of the same length of input-list. Some elements in the returned list are transformed as requested by transform-spec.
See also Scheme source file transform-ast-list
similar function transform-ast
related functions traverse-and-collect-all-from-ast traverse-and-collect-first-from-ast
usefully applied on results of ast-subtrees traverse-and-collect-all-from-ast
useful predicate generator ast-of-type?

transform-ast
Form (transform-ast ast . transform-specs)
Description Transform ast by means of transform-specs. The parameter transform-specs is of the same kind as in the function transform-ast-list. During the transformation, AST nodes which are not matched by the transform-specs are copied. When some sub AST has been transformed, the transformed sub AST is not recursively transformed.
Parameters ast The data to be transformed. Either an AST, textual contents, or a white space marker.
transform-spec A list of transformation specifications, each of which is a list of length 2: (input-predicate transformation-function)
Returns The transformed AST.
See also Scheme source file transform-ast
similar function transform-ast-list
useful predicate generator ast-of-type?


23 XML validation procedures.
The functions in this section provide access to the XML-in-LAML validation procedures. The validation functions are part of the mirrors of a given XML language in Scheme. In normal and native use of XML-in-LAML, the validation procedures are called by the mirror functions. If the internal AST structure is created by other means (for instance authored directly, or made via a parser) it is relevant to get access to the validation procedures. This is the rationale behind the functions in this section.

validation-procedure-map-of
Form (validation-procedure-map-of language)
Description A validation procedure map of an XML language is a sorted, associative vector that maps element names to XML validation procedures. The validation procedures are produced by the XML-in-LAML mirror generation tool. This function returns the sorted associative vector of language. If no validation procedure map exists for language, this function returns false.
Parameters language The name of the language (string or symbol)
See also Scheme source file validation-procedure-map-of

validation-procedure-of
Form (validation-procedure-of element-name language)
Description Return the XML validation procedure of the element named element-name in language. A validation procedure is created by the XML-in-LAML mirror generation tool on basis of an XML DTD of language. A validation procedure takes four parameters: element-name (string), attributes (property list), element content item list, and a boolean (XML language overlap check or not). If language does not make sense, or if the element is unknown in the map, return #f
Parameters element-name The name of the element (string or symbol)
language The name of the language (string or symbol)
See also Scheme source file validation-procedure-of

register-xml-in-laml-validators
Form (register-xml-in-laml-validators language validator-structure)
Description Register validator-structure for language. This function is called "automatically" when the mirror functions are loaded.
See also Scheme source file register-xml-in-laml-validators

validate-ast!
Form (validate-ast! ast [given-language language-overlap-check?])
Description Validate ast. XML validation is integrated in the mirrors of the XML elements in Scheme. Thus, this procedure is only useful if the AST is created by other means (manually, or via a parser, for instance). Validation problems are reported by the procedure xml-check-error. This is a procedure that produces errors or warnings (depending on xml-check-error). The ast is valid if no error messages or warnings are produced by this function.
Parameters ast The internal representation of the document to be checked
given-language The XML language to which ast belongs. Defaults to (ast-language ast). A symbol.
language-overlap-check? Check for mutual naming overlap among the loaded XML languages. A boolean. Defaults to #t.
See also Scheme source file validate-ast!
error function xml-check-error


24 Element content models.
The functions in this section make the content models of the XML elements available. As an example, this allows us to find out if an element is empty. The element content models are defined by the XML DTDs, and as such they are used for generation of the XML validation procedures.

content-model-map-of
Form (content-model-map-of language)
Description Returns the content model map (an association list) of a given XML language. A content model map of an XML language is an sorted associative vector that maps element names (strings) to the parsed content models of the element, as provided by the the LAML XML-DTD parser.
See also Scheme source file content-model-map-of

content-model-of
Form (content-model-of element-name language)
Description Return the content model of the element named element-name in XML language. The content model is the parsed content model, as delivered by the LAML XML-DTD parser. If the content model is not available for some reason (unknown element-name, unknown XML language) return #f.
See also Scheme source file content-model-of

register-xml-in-laml-content-models
Form (register-xml-in-laml-content-models language content-model-structure)
Description Register the content model structure for XML language. This function is called "automatically" when the Scheme mirror of the XML language is loaded.
See also Scheme source file register-xml-in-laml-content-models


25 Action procedure map.
An action procedure map is a sorted associative vector that maps certain element names to action procedures.

action-procedure-map-of
Form (action-procedure-map-of language)
Description Return the action procedure map of the XML language.
See also Scheme source file action-procedure-map-of

action-procedure-of-language
Form (action-procedure-of-language element-name language)
Description Return the action procedure of the XML element named element-name in the XML language. If there is no action procedure associated with the element, or if the action procedure structure is not available for language, return #f.
See also Scheme source file action-procedure-of-language

action-procedure-of-map
Form (action-procedure-of-map element-name action-procedure-map)
Description Return the action procedure of the XML element named element-name relative to the action procedure map action-procedure-map.
See also Scheme source file action-procedure-of-map

register-xml-in-laml-action-procedures
Form (register-xml-in-laml-action-procedures language action-procedure-structure)
Description Register the action procedure structure for XML language. An action procedure structure is a sorted, associative vector that maps XML elements (stings) to their action procedures. Notice that this is only a partial mapping. This function is called "automatically" when the Scheme mirror of the XML language is loaded.
See also Scheme source file register-xml-in-laml-action-procedures

process-ast!
Form (process-ast! ast [given-language action-map])
Description Process the ast, the internal document representation, by means of the action procedures in action-map. The action map is a sorted associative vector that maps element names to action procedures. The default value of action-map is (action-procedure-map-of given-language).
Parameters ast The internal representation of the document to be processed.
given-language The language to which ast belongs. Bound at root level. Defaults to (ast-language ast). A symbol.
action-map The action map that maps elements in the XML language to action procedure. Defaults to (action-procedure-map-of given-language). A sorted associative vector.
See also Scheme source file process-ast!
action procedure access action-procedure-map-of


26 Other useful functions.
In this section there are non-mirror functions which are useful in in the context of XML and LAML.

ast-to-parse-tree
Form (ast-to-parse-tree ast)
Description Convert an abtract syntax tree to a parse tree. Abstract syntax trees are produced by the validating mirror functions. Parse trees are used as an internal format in the HTML and the XML pretty printing procedures. You can use the function pretty-print-html-parse-tree on the parse tree returned by ast-to-parse-tree.
Precondition The LAML tool html-support (for parsing and pretty printing) must be loaded for this function to work.
See also Scheme source file ast-to-parse-tree
Note To load html-support: (laml-tool-load "xml-html-support/html-support.scm")


Generated: June 17, 2005, 17:51:44
Generated by LAML SchemeDoc using LAML Version 27.1 (June 17, 2005, full)