The mv:modularvocab Element

The mv:modularvocab element is the root element of a modular vocabulary. It contains any number of init-parameter, set-parameter, declare-prefix, or mode elements, in any order. The only attribute allowed for mv:modularvocab is the xmlns:mv attribute defining its XML namespace to be http://gloss.bham.ac.uk/xmlns/modularvocab.

1 mv:mode elements

The main content of the modular vocabulary is its mv:modes. A mode defines the allowed tokens at that point and what actions to take on receiving a token. Modes are described further in overview in Writing Modular Vocabulary Files, and in detail in Modes.

2 mv:declare-prefix

This element has required attributes prefix="..." and uri="...". Its allowed content is any mixture of mv:init-parameter, mv:set-parameter, mv:declare-prefix, or mv:mode elements (i.e., the same as for mv:modularvocab). The element's job is to associate a prefix given in prefix="..." to a specific uri. Then mode names and parameter names with this prefix are considered in the uri's namespace and will not clash with mode names and parameter names with similar names but in a different namespace. Neither attribute value given in prefix="..." and uri="..." is interpolated. (See Parameters for further information on parameter values and interpolation.)

A modular vocabulary may have several prefixes declared. The scope of a declaration is the content of the mv:declare-prefix element, and an inner declaration overrules a previous outer declaration of the same prefix. As described elsewhere, a prefixed identifier such as P:NAME expands to {URI}NAME. If necessary, to reference a parameter or mode defined using a prefix outside the scope of the mv:declare-prefix element the URI can be given explicitly as above. Also, two different prefixes can map to the same URI, in different parts of the same document perhaps. Note too that the URI is used as an identifying string only: there is no guarantee that there is an HTML document served there, though there might be and it could be a good place to look for information.

An example of a modularvocab using prefixes in the sort of way indicated here is prefixexample.mv. This MV requires an empty document as input.

3 mv:set-parameter and mv:init-parameter

Parameters are described in more detail in a separate page. They may be initialized and (re)set with mv:init-parameter and mv:set-parameter. Both these elements are empty and take as attributes name="..." for the name of the parameter, and value="..." for the new value for the parameter. The difference between the two commands is that mv:init-parameter will not change a parameter which has already been initialized or set, whereas mv:set-parameter will initialise and/or reset parameters. Otherwise they behave in an identical fashion.

Before it is executed, a modular vocabulary is scanned for mv:set-parameter and mv:init-parameter commands at top level (i.e., direct children of the mv:modularvocab element or any mv:declare-prefix elements) and these commands are executed in the order they appear. This involves interpolating both arguments name="..." and value="..." according to the rules given elsewhere (including any use of prefixes), testing if parameter has already been set in the case of mv:init-parameter, and (if then necessary) setting the parameter.

This page is copyright. Web page design and creation by GLOSS.