The file <glossdir>/mv/xml/def.modes contains a small additional module as a helper-module for XML processing. It allows the user to set and use parameters on the fly for text-snippets.
define-text @name@value NAME .. NAME ...
e.g.,
define-text @name[glossuri] @value[http://gloss.bham.ac.uk]
...
p [The GLOSS system's homepage is at [tt glossuri].
Documentation is provided at [tt [[glossuri]/doc]].]
You can also set parameters directly from MV files when this module is loaded:
<mv:set-parameter @name="def:def:NAME" @value="yes"/>
<mv:set-parameter @name="def:val:NAME" @value="VALUE"/>
def.modes is an extension module for xml.modes. and is generated from modes.mv in the usual way. The MV def-xml.mv loads both xml.modes and def.modes.
dialogue
define-text @name[bill] @value[Shakespeare]
define-text @name[ben] @value[Jonson]
define-text @name[tom] @value[Kyd]
conversation
para [[q[To be or not to be,]] said [bill].]
para [[q[What was that [bill]?]] said [ben].]
para [[q[Never mind,]] said [bill].]
para [[q[But I do mind,]] said [tom].]
para
define-text @name[tom] @value[Middleton]
[[q[Hello, what are you talking about?]] said [tom].]
para [[q[I don't know,]] said [tom].]
produces
<dialogue> <conversation> <para><q>To be or not to be,</q> said Shakespeare.</para> <para><q>What was that Shakespeare?</q> said Jonson.</para> <para><q>Never mind,</q> said Shakespeare.</para> <para><q>But I do mind,</q> said Kyd.</para> <para><q>Hello, what are you talking about?</q> said Middleton.</para> <para><q>I don't know,</q> said Kyd.</para> </conversation> </dialogue>
!declare-prefix @prefix[def] @uri[http://gloss.bham.ac.uk/mv/xml/def] {
!declare-prefix @prefix[xml] @uri[http://gloss.bham.ac.uk/mv/xml/xml] {
!mode @name[def:structured-content] @template[xml:structured-content]
!hook @mode[xml:structured-content] @action[process]
define-text
!set-parameter @name[def:name] @value[]
!set-parameter @name[def:value] @value[]
!set-parameter @name[def:found:name] @value[]
!set-parameter @name[def:found:value] @value[]
!process-tokens @mode[def:get-attr] @parameters[share]
!if-not @test[$\{def:found:name\}]
!message[ERROR$: Missing @name attribute in line $l[
]]
!if-not @test[$\{def:found:value\}]
!message[ERROR$: Missing @value attribute in line $l[
]]
!set-parameter @name[def:def:$\{def:name\}] @value[yes]
!set-parameter @name[def:val:$\{def:name\}] @value[$\{def:value\}]
!elt
!if @test[$\{def:def:$q\}]
!text [$\{def:val:$q\}]
!else !execute @mode[xml:structured-content] @hook[process]
!include @mode[xml:structured-content] @hook[process]
!mode @name[def:get-attr] @accept[attr|] @type[process]
!attr @fullname[$name||value]
!process-tokens @mode[xml:process-attr]
!set-parameter @name[xml:attr-param] @value[def:$n]
!set-parameter @name[def:found:$n] @value[yes]
!default
!return
}; !declare-prefix
}; !declare-prefix
This file is part of the GLOSS system, Copyright Richard Kaye http://gloss.bham.ac.uk/. Usage permitted under the GPL. No Warranty.
This page is copyright. Web page design and creation by GLOSS.