<?xml version="1.0" encoding="utf-8"?><article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0-subset Balisage-1.5">
    <title>Extending the TEI Processing Model to Describe Digital Edition Interactions</title>
    <info>
    <confgroup>
      <conftitle>Balisage: The Markup Conference 2026</conftitle>
      <confdates>August 3-7, 2026</confdates>
   </confgroup>
        <abstract>
            <para>The TEI Processing Model (TEI PM) provides a declarative specification for publishing 
                digital editions, but the behaviours that it facilitates are, with a few exceptions, 
                completely static. Digital editions, however, are by nature interactive tools. After a brief 
                recap of the TEI PM, the paper discusses, first at an abstract level, then more concretely, 
                a number of issues that definitions of interactive behaviours will have to tackle. 
                It proposes a number of new behaviours, most of them inspired by the Web Components
                of TEI Publisher, currently the only implementation of the TEI PM.  
            </para>
            <para>The paper is part of a larger project that investigates how far we can get with a 
                100% declarative specification of digital edition functionality.</para>
        </abstract>
        <author>
            <personname><firstname>Peter</firstname> 
            <surname>Boot</surname></personname>
            <personblurb>
                <para>Peter Boot is a senior researcher at the Huygens Institute for 
                    the History and Culture of the Netherlands. He has worked as an XML consultant and 
                    project lead on various digital edition projects, such as the Letters of Vincent 
                    van Gogh, the Mondrian Papers and the Anne Frank manuscripts.</para>
            </personblurb>
            <affiliation><orgname>Huygens Institute for the History and Culture of the Netherlands</orgname></affiliation>
            <email>peter.boot@huygens.knaw.nl</email>
        </author>
<legalnotice><para>This paper is licensed under a Creative Commons Attribution 4.0 International license.</para></legalnotice>
        <keywordset role="author">
            <keyword>TEI</keyword>
            <keyword>TEI Processing Model</keyword>
            <keyword>Declarative Markup</keyword>
            <keyword>Publishing</keyword>
            <keyword>TEI Publisher</keyword>
        </keywordset>
    </info>
    <section>
        <title>Introduction</title>
        <para>In the following paper I will discuss the question of how to extend the TEI Processing Model's 
            (TEI PM) behaviours with interactive functionality. The TEI PM facilitates attaching 
            <emphasis>behaviours</emphasis> to TEI XML elements (<xref linkend="turska2016"/>); using 
            these behaviours, projects can describe the desired presentation of their encoding. However, 
            almost all behaviours that are currently available are static: there is no way for a project 
            to describe how a user can interact with the generated site. I will discuss here some 
            issues that arise when defining interactive behaviours and propose a number of experimental 
            (but implemented) behaviours.</para>
        <para>The paper is part of a project that proposes to create a fully declarative specification 
            for the user interface of digital editions. Earlier work includes 
            <xref linkend="boot2024"/> and <xref linkend="bootxxxx"/>.<footnote>
                <para>See the <link xlink:href="https://gitlab.huc.knaw.nl/edition-publication-model" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Edition Publication Model</link> project.</para>
        </footnote>
            Here, I begin with a brief recap of the TEI PM. Then we look at the problem formulated at 
            a very abstract level, followed by a description of the (very concrete) interactive behaviours 
            available in <link xlink:href="https://teipublisher.com/" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">TEI Publisher</link>, to date the 
            only implementation of TEI PM. Then I discuss the various issues we'll have to deal with. 
            Finally, I propose some experimental behaviours.</para>
    </section>
    <section>
        <title>TEI Processing Model recapitulation</title>
        <para>The TEI Processing Model 
            (<xref linkend="tei2026"/>, <link xlink:href="https://tei-c.org/release/doc/tei-p5-doc/en/html/TD.html#TDPMPM" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">section 23.5.4.1</link>) 
            makes it possible to provide a declarative specification for the presentation of XML documents.<footnote>
                <para>While the TEI PM was developed in a TEI context, its functionality can be used in the 
                    context of any XML vocabulary. For example, the TEI Publisher documentation is written in 
                    DocBook but published using TEI PM definitions. TEI Publisher also 
                    <link xlink:href="https://teipublisher.com/doc/documentation.xml?action=search&amp;root=3.21" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">publishes JATS</link>.</para>
            </footnote> It describes a number of behaviours that can be attached to XML elements. Behaviours include general textual behaviours such as 
        <code>paragraph</code>, <code>block</code>, and <code>figure</code>, as well as more specialised edition behaviours, such as 
            <code>alternate</code> (inline element with default and alternate display) and <code>note</code>. TEI elements can be mapped to behaviours 
            using the <code>model</code> element. The <code>predicate</code> attribute on the <code>model</code> element can contain an XPath expression that determines appropriate 
            processing based on an element's position in the document.<footnote>
                <para>Note this use of 'predicate', essentially as a filter mechanism, is quite different from 
                    the meaning of 'predicate' in the RDF world.</para>
            </footnote> That makes it possible, for example, to handle the <code>title</code> of the TEI document 
            itself (<code>predicate="parent::titleStmt"</code>) and the <code>title</code>s of bibliographical items (<code>predicate="parent::bibl"</code>)
            differently.</para>
        <para>Models can have parameters (<code>param</code> elements) to further specify their behaviour.
            The most important parameter is <code>content</code>: if it isn't specified, the children of the currently processed element form the 
            content of a model, but the PM can override that. For example, if we are processing a <code>pb</code> (page begin) element, we can use the 
            corresponding graphic as its content.
            There are various hooks for attaching CSS styling, such as the <code>cssClass</code> attribute on the <code>model</code> element. 
            The mapping of elements to behaviours is described in the TEI schema definition 
            'ODD' (One Document Does all) document. <code>elementSpec</code> elements describe the behaviours 
            appropriate for that element. The <code>model</code> element that is applied is the first <code>model</code> where there is no 
            <code>predicate</code> or where evaluation of the <code>predicate</code> results in <code>true</code>. 
            As TEI schema definitions can import other schema definitions, it is 
            possible to provide a set of standard behaviours for all elements, and selectively override these in the
            importing schema definition.</para>
        <para>The behaviours included in the TEI PM are user-level behaviours. They offer functionality that a user would recognise 
            and abstract away from implementation details. For example, the <code>note</code> behaviour takes care of the mechanics 
            that implement the bidirectional link between the note and the note number. Although the processing might remind one of XSLT 
            templates, the TEI PM is much closer to the world of the user. This becomes more important when we want to describe 
            more complex aspects of edition functionality, such as interactivity.</para>
        <para>Here are some examples. In the first example, we see that the predicate is used to distinguish the case where the TEI <code>salute</code> 
            element is used inline or on its own: </para>
<programlisting language="xml" xml:space="preserve">
&lt;elementSpec ident="salute" mode="change"&gt;
    &lt;model predicate="parent::closer" behaviour="inline"/&gt;
    &lt;model behaviour="block"/&gt;
&lt;/elementSpec&gt;
</programlisting>
        <para>In the following example, we see how parameters are used in the <code>alternate</code> behaviour.
            That behaviour is assigned to the <code>choice</code> element if it has <code>sic</code> and <code>corr</code> children 
            (a mistake and its correction). The <code>param</code>'s  
            <code>value</code> attribute is again an XPath expression:</para>
<programlisting language="xml" xml:space="preserve">
&lt;elementSpec ident="choice" mode="change"&gt;
    &lt;model predicate="sic and corr" behaviour="alternate"&gt;
        &lt;param name="default" value="corr[1]"/&gt;
        &lt;param name="alternate" value="sic[1]"/&gt;
    &lt;/model&gt;
&lt;/elementSpec&gt;
</programlisting>
        <para>The TEI PM is agnostic with respect to the implementation environment. Most of its behaviours 
            could be realised on the web, in print or even in plain text. Where necessary, specific instructions  
            for certain output environments can be created with the <code>output</code> attribute.</para>
        <para>Projects that use the TEI PM will normally start from a default ODD (for instance, the ODD of the TEI 
            <link xlink:href="https://tei-c.org/release/doc/tei-p5-exemplars/html/tei_simplePrint.doc.html" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">simplePrint 
                customisation</link> or the default ODD used in TEI Publisher). They will create their own ODD that 
            only defines those elements where they want the behaviour to be different from the default behaviour. The XML 
            files that contain the edited texts remain untouched, they do not need to contain 
            any processing information. The implementation will then jointly process the XML content 
            files and the ODD files and produce the presentation.</para>
        <para>As mentioned, <link xlink:href="https://teipublisher.com" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">TEI Publisher</link> is an implementation 
            of the TEI PM. TEI Publisher is used by <link xlink:href="https://www.e-editiones.org/map/" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">an 
                impressive number of edition projects</link>. It is a tool maintained by the <link xlink:href="https://www.e-editiones.org" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">e-editiones</link> 
            non-profit organisation. Recently e-editiones announced the 
            <link xlink:href="https://www.e-editiones.org/assets/files/prospectus-2026-05-11.pdf" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Open Processing Model</link>, 
            an initiative to create a second implementation of the TEI PM. Given the wide adoption and the existing software 
            environment around it, TEI PM seems the natural starting point for a declarative interface specification. </para>
    </section>
    <section>
        <title>The view from afar</title>
        <para>Put at its most abstract, the issue that we discuss is how to describe changes of the digital edition from one state to another. 
            Note that, for the purposes of this paper, we assume read-only interfaces.
            A state of the digital edition consists of three things: (i) the edition source data, 
            presumably a collection of XML files, (ii) a hierarchically organised set of content panels, 
            which I will assume are defined in HTML, combined with (iii) an internal state. 
            The internal state can contain user 
            preferences and other settings, as well as, for instance, a set of current search results. 
            A change of state is a mapping from one state (source, HTML, internal state) to another. 
            Modelling the interactive aspects of the edition implies describing how user actions 
            trigger execution of these mappings. The user actions translate in events happening 
            to nodes in the HTML tree. So, what we model is actually a function that maps events 
            on nodes in the HTML tree to state transformations of the edition, that is: a new 
            HTML tree and a new internal state. (In a read-only environment the sources 
            remain unchanged.)</para>
        <para>To make this more concrete, some examples:</para>
        <itemizedlist>
            <listitem>
                <para>The user clicks a checkbox that toggles a display of paragraph numbers for the edited texts.</para>
            </listitem>
            <listitem>
                <para>The user selects a sort order from a drop-down box and a list of persons mentioned in the edition is sorted by date of birth rather than by last name.</para>
            </listitem>
            <listitem>
                <para>The user clicks a forward arrow and the display moves to the next (say) charter in the list of current search results (here is a case where we need to take into account the edition's internal state).</para>
            </listitem>
            <listitem>
                <para>A mouseover on a line of verse in a manuscript transcription highlights that line in the manuscript image, or in one or more panels displaying the same text as given in other manuscripts. </para>
            </listitem>
            <listitem>
                <para>A click on a menu item takes us from the edited text to supporting material such as a list of witnesses, an introduction or a bibliography. </para>
            </listitem>
        </itemizedlist>
        <para>The abstract formulation of what we are trying to achieve makes immediately clear that this task is much more complicated than what the TEI PM initially set out to do. The TEI PM currently describes a mapping of essentially a single XML source document to behaviours, which an implementation then translates into HTML. Some of these behaviours have interactive aspects (alternate, link, perhaps note) but by and large the result is a static tree. The <code>predicate</code> and <code>value</code> attributes that govern the generation of that tree contain XPath expressions that refer to a single source document. Describing interaction requires us to model the following aspects:</para>
        <itemizedlist>
            <listitem>
                <para>not just the output tree, but changes in the output tree;</para>
            </listitem>
            <listitem>
                <para>the internal state of the edition;</para>
            </listitem>
            <listitem>
                <para>events happening to nodes;</para>
            </listitem>
            <listitem>
                <para>switches in the input: rendering another XML file of the same type (another charter or another letter) or of a different type (an introduction, a personography);</para>
            </listitem>
            <listitem>
                <para>associations between these four aspects.</para>
            </listitem>
        </itemizedlist>
        <para>An example of an abstract high-level description of (modifying) user interfaces is given in the User Interface 
            Markup Language (UIML) standard (<xref linkend="helms2009"/>). UIML describes UIs in very generic terms 
            as a hierarchy of <code>part</code>s under a <code>structure</code> element. 
            These <code>part</code>s are of a certain <code>class</code> and these classes are meant to be mapped to the classes of specific user 
            interface platforms such as HTML or GTK or Java Swing. <code>part</code>s have an <code>id</code> and can have various properties. 
            Modifications of the interface (i.e., the result of interaction) are described in <code>rule</code>s that are contained in <code>behavior</code> 
            elements. Rules consist of <code>condition</code>s and <code>action</code>s. Conditions can refer to <code>event</code>s 
            (the occurrence of an event of a certain type to an object with a certain id) and to properties of <code>part</code>s, 
            combined by simple <code>op</code>s (operations, such as <code>equal</code>, <code>notequal</code>, <code>lessthan</code>, etc.). 
            Actions can change the values of properties, do a function call or restructure the interface. An interface 
            <code>restructure</code> consists in deleting, replacing or adding structures in the <code>part</code>s hierarchy. </para>
        <para>As far as I see, there are some obvious limitations to the usefulness of UIML for our case. For one thing, it doesn't describe how 
            the user interface depends on the data that it needs to accommodate (it mentions at a very general level how this might be 
            accomplished (page 4) but gives no details, not even that it is left to the implementation). It also describes all variation in interface construction as the result of 
            first creating the interface and then changing it, rather than facilitating selection of parts in the initial 
            creation of the interface. However, the ideas (i) of parts having properties that one can get and set, 
            (ii) that one can combine with event logic using operators resulting in (iii) interface 
            restructure operations are potentially very useful. </para>
    </section>
    <section>
        <title>The view from close by</title>
        <para>Fortunately, our modelling effort need not start at the most abstract level. There is a collection of user interface components 
            available in TEI Publisher.
            Set the task of developing usable editions on the basis of the TEI PM, the creators of 
            TEI Publisher have developed a set of web components that provide a large part of the 
            interaction widgets without which the digital edition would be as static as its printed predecessors. 
            These components are available in a separate library and documentation is available.<footnote>
                <para><link xlink:href="https://teipublisher.com/doc/webcomponents.xml" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Documentation of the web components</link> and 
                    their <link xlink:href="https://cdn.tei-publisher.com/@3.0.0-next-4.13/dist/api.html" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">API documentation</link>.</para>
            </footnote>  
            Examples include:</para>
        <itemizedlist>
            <listitem>
                <para><code>pb-facsimile</code> (for displaying facsimiles) and <code>pb-facs-link</code> (for activating (regions on) facsimiles);</para>
            </listitem>
            <listitem>
                <para><code>pb-lang</code> (for setting the interface language) and <code>pb-i18n</code> (for displaying translations of text, depending on the interface language);</para>
            </listitem>
            <listitem>
                <para><code>pb-toggle-feature</code> (for toggling display features on or off);</para>
            </listitem>
            <listitem>
                <para><code>pb-highlight</code> (for highlighting a corresponding piece of text elsewhere on the page).</para>
            </listitem>
        </itemizedlist>
        <para>Given the availability of these components, we could wonder whether the TEI couldn't just adopt the interactive 
            components as defined by TEI Publisher and include these as new behaviours in the <emphasis>TEI Guidelines</emphasis>. 
            Indeed, for some components that might be the case. But in general, I believe that we should not adopt these components wholesale but rather ask: if we would start anew, how would we design these behaviours? Maybe in some cases the TEI Publisher components, being part of a specific toolset, were designed with the choices of that toolset in mind. Or maybe in some cases the definitions include technicalities that do not belong in a more abstract specification. </para>
        <section>
            <title>Functionality overview</title>
            <para>What follows here gives an indication of the scope of interactive functionality that modern read-only digital 
                editions exhibit. It is based on the documentation of TEI Publisher's web components as well 
                as on an inspection of a number of recent editions. No doubt there will be functionality that 
                I have missed. With every item, I mention the corresponding behaviours in TEI Publisher. </para>
            <section>
                <title>Global</title>
                <itemizedlist>
                    <listitem>
                        <para>Set language (<code>pb-lang</code>) and other user preferences</para>
                    </listitem>
                    <listitem>
                        <para>Allow access based on authorisations (<code>pb-logon</code> and <code>pb-restrict</code>)</para>
                    </listitem>
                </itemizedlist>
            </section>

            <section>
                <title>On overview pages</title>
                <itemizedlist>
                    <listitem>
                        <para>Data selection, based on properties of items (<code>pb-split-list</code>, <code>pb-toggle-feature</code>)</para>
                    </listitem>
                    <listitem>
                        <para>Faceted search (<code>pb-browse-docs</code>)</para>
                    </listitem>
                    <listitem>
                        <para>Full-text search (<code>pb-browse-docs</code>)</para>
                    </listitem>
                    <listitem>
                        <para>Sorting (<code>pb-browse-docs</code>)</para>
                    </listitem>
                    <listitem>
                        <para>Grouping</para>
                    </listitem>
                </itemizedlist>
            </section>

            <section>
                <title>On Detail pages</title>
                <itemizedlist>
                    <listitem>
                        <para>Interface options, such as turning numbering on or off, displaying abbreviations or expansions, displaying a critical or a diplomatic text, displaying actionable references or not, etc. (<code>pb-toggle-feature</code>, <code>pb-select-feature</code>) </para>
                    </listitem>
                    <listitem>
                        <para>Interface actions, such as highlighting corresponding elements (<code>pb-highlight</code>), showing popups (<code>pb-popover</code>), scroll to a certain object or phrase in a certain panel, opening or closing panels, resizing panels</para>
                    </listitem>
                    <listitem>
                        <para>Load other content, e.g., a next or previous page (<code>pb-navigation</code>), load other content from embedded table of contents or similar (<code>pb-link</code>, the embedded table of content might be realised as a <code>pb-drawer</code>)</para>
                    </listitem>
                </itemizedlist>
            </section>
            
            <section>
                <title>Various</title>
                <itemizedlist>
                    <listitem>
                        <para>Messages and dialogs (<code>pb-message</code>, <code>pb-dialog</code>)</para>
                    </listitem>
                    <listitem>
                        <para>Copy to clipboard (<code>pb-clipboard</code>)</para>
                    </listitem>
                    <listitem>
                        <para>Autocomplete search terms (<code>pb-search</code>)</para>
                    </listitem>
                    <listitem>
                        <para>Print (<code>pb-print-preview</code>)</para>
                    </listitem>
                    <listitem>
                        <para>Downloads (<code>pb-download</code>)</para>
                    </listitem>
                </itemizedlist>
            </section>

        </section>
    </section>
    <section>
        <title>Issues to consider</title>
        <section>
            <title>Modelling (interaction with) internal state</title>
            <para>As an example, let us use the case of a user interface language toggle. Suppose an edition should be available in Dutch and in English. 
                On every page, the user can switch the user interface language. That has consequences for literal text in the interface 
                as well as for some data: letters and artworks in the edition have titles in both languages, we want a notes panel, if present, 
                to switch language, and artwork dimensions should use a decimal point in English or comma in Dutch.</para>
            <para>To handle GUI texts, we can create two behaviours inspired by TEI Publisher's <code>pb-lang</code> and <code>pb-i18n</code>: <code>pb-lang</code> provides a widget to set the preferred language and <code>i18n</code> is a component that changes the language of text content based that preferred language. We will need to define a mechanism that provides a list of available languages and the data necessary for translation. (TEI Publisher allows us to provide an HTML <code>select</code> element 
                within <code>pb-lang</code> to select the languages or creates the <code>select</code> itself; it doesn't describe howw to provide a translation table.)</para>
            <para>What TEI publisher also provides is a mechanism for the components to talk to each other: all of its web components can send events to and listen to so-called <emphasis>channels</emphasis>. When we use a web component we can rely on a global channel or choose specific channel(s) to which it will emit events and to which it listens. The channel mechanism is a flexible way of letting components talk to each other without them needing to know anything about each other's internal workings. At the level of defining application-independent behaviours, I think we don't need to provide such a messaging mechanism, but we will need to think about how behaviours can refer to each other's state.</para>
            <para>It gets more complicated when we want to go beyond the interface literals and want to select text from our 
                edition XML based on the UI language setting. Remember that in the TEI PM, selection of text to be displayed 
                is either done in a <code>predicate</code> attribute on a <code>model</code> or in a 
                <code>value</code> attribute in a <code>model</code> <code>param</code> element, both of which contain 
                XPath expressions. These expressions refer to the content of the XML file that we are processing. 
                How could we, in this context, bring in a current application state, such as the user-selected language preference?</para>
            <para>An option that I explored is a UIML-like explicit formalism of formulating conditions and rules. Rather than:</para>
<programlisting language="xml" xml:space="preserve">
&lt;param name="content" value="tei:title"/&gt;
</programlisting>
            <para>which would select titles in Dutch and in English, we could write:</para>
<programlisting language="xml" xml:space="preserve">
&lt;param name="content"&gt;
    &lt;if&gt;
        &lt;condition&gt;
            &lt;op name="equals"&gt;
                &lt;property name="user-language" 
                        part-id="language-control"/&gt;
                &lt;constant type="string"&gt;nl&lt;/constant&gt;
            &lt;/op&gt;
        &lt;/condition&gt;
        &lt;then value="tei:title[@xml:lang='nl']"/&gt; 
        &lt;else value="tei:title[@xml:lang='en']"/&gt; 
    &lt;/if&gt;
&lt;/param&gt;
</programlisting>
            <para>This has the advantage that it creates an explicit dependency of the selected content on the state of the 
                language-control (the UI element with <code>id='language-control'</code>), but it is really verbose, 
                and it wouldn't work when the number of choices grows. </para>
            <para>The more flexible choice is using parameters in XPath expressions, the choice that TEI Publisher made. 
                (The disadvantage of this is that the application needs to parse the XPath expression in order to find 
                assignments that depend on application state.) TEI Publisher allows the developer 
                to <link xlink:href="https://teipublisher.com/doc/documentation.xml?id=setting-parameters#setting-parameters" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">set 
                    parameters for the PM</link> in various ways, for instance, from the HTML template that 
                will embed the output of the PM or from any behaviour within the PM. Some variables are 
                provided  by the system, such as the root of an application's data collection. The parameters 
                can then be used in downstream <code>predicate</code> and <code>value</code> attributes. 
                Cases mentioned in the documentation where parameters are useful are selections based on a processing mode or 
                the selection of data in the user's preferred language. Assuming a variable <code>$user-language</code> we could write:</para>
<programlisting language="xml" xml:space="preserve">
&lt;elementSpec ident="title"&gt;
    &lt;model behaviour="heading" predicate="@xml:lang=$user-language"/&gt;
&lt;/elementSpec&gt;
</programlisting>
            <para>There exists a potential problem for this solution. Unlike eXist-db, TEI Publisher's environment, some execution environments for dynamic XPath (notably, the XSLT standard, and also FontoXPath and the Saxon evaluate function) require that when using dynamic XSLT, parameters in the expression are explicitly provided with a value. To avoid excluding these implementation environments, the TEI PM would need a way of specifying parameters' values. The simplest solution would probably be an agreement to provide all necessary parameters as entries in a single map with a standardized name, e.g., <code>$context</code>. We could then rewrite the previous model as:</para>
<programlisting language="xml" xml:space="preserve">
&lt;elementSpec ident="title"&gt;
    &lt;model behaviour="heading" 
            predicate="@xml:lang=$context?user-language"/&gt;
&lt;/elementSpec&gt;
</programlisting>
            <para>and an XSLT implementation of the PM could then execute the statement as:</para>
<programlisting language="xml" xml:space="preserve">
&lt;xsl:evaluate context-item="..." xpath="@predicate"&gt;
    &lt;xsl:with-param name="context" select="$context"/&gt;
&lt;/xsl:evaluate&gt;
</programlisting>
        </section>
        <section>
            <title>Modelling (interaction with) events</title>
            <para>As an example, let us look at the TEI Publisher <code>pb-highlight</code> component. The component has the effect that on click or mouseover it highlights (other) <code>pb-highlight</code> components with the same <code>key</code> value.  The <code>key</code> can be set to an arbitrary value. It can be used, for instance, to highlight the same line of verse in multiple versions of a poem. It is clear that the component has to listen to events (<code>click</code> or <code>mouseover</code>), but the creator of the edition just specifies <code>click</code> or <code>mouseover</code> on the <code>trigger</code> parameter. There is no need for an explicit reference to something like the UIML <code>event</code> elements at the level of the PM. </para>
            <para>As another example, suppose we want a checkbox that determines whether paragraph numbers are shown in the margin of a transcription. Again, the component will have to listen to events on the checkbox (<code>click</code> or <code>change</code>), but for specifying the behaviour on the paragraph numbers, we could just have:<footnote>
                    <para>The value <code>displayiff</code> is meant to suggest 'display if and only if'.</para>
            </footnote></para>
<programlisting language="xml" xml:space="preserve">
&lt;param name="displayiff"&gt;
    &lt;condition&gt;
        &lt;property name="checked" part-id="cb-paranum"/&gt;
    &lt;/condition&gt;
&lt;/param&gt;
</programlisting>
            <para>or even shorter:</para>
<programlisting language="xml" xml:space="preserve">
&lt;param name="displayiff" value="$context?cb-paranum-checked"/&gt;
</programlisting>
            <para>This is true for all interactive widgets that I have been able to think of. The definition of the widget will state what events it listens to, and the developer of an implementation might formalise that definition using <code>event</code> elements; the creator of an edition can refer to a property of a widget. As a final example, think of the <code>link</code> behaviour. By definition the link is executed on a click, and on a mouseover some clarifying information will be shown. The creator of the edition just specifies the target and the extra information, not the events.</para>
        </section>
        <section>
            <title>'Re-entry' into the PM, location of execution</title>
            <para>Many types of interactivity take the form of either displaying or not some information. Displaying paragraph numbers or not is a clear case, opening or closing an extra panel (e.g., of a translation) is another case. Cases where we display one thing or another (a correction in a text or the original form) can be seen as a combination of two things that are displayed or not, but with the condition reversed. One could even think of any page in an edition (say a chapter page) as a display of an entire book's edition, with all other chapters turned off. </para>
            <para>When thinking of 'turning off' display of bigger or smaller html fragments we tend to think of an action at the client side, in JavaScript, setting <code>style.display = none</code> or something similar. But the TEI PM itself has no notion of a client or server. There is no a priori reason why entire PM definitions couldn't be processed on the client, but even if there were such a reason, the PM doesn't specify which parts should be processed where.</para>
            <para>TEI Publisher has a <code>pb-toggle-feature</code> component, that can do its processing server side or client side, 
                depending on the supplied <code>param</code>s. In the context of TEI Publisher, that is fine, but in the context of the TEI PM, the 
                distinction should be between reprocessing the panel's PM definitions or taking a shortcut. Sometimes the shortcut 
                will be appropriate (hiding or displaying paragraph numbers), sometimes processing the PM will be appropriate 
                (display a new panel), sometimes either has advantages (showing abbreviations or showing their expansions).</para>
            <para>When we want to trigger (re-)execution of the PM from an action on the HTML page, we will have to know which part(s) of the PM we need to re-execute. Are we going to regenerate the whole page? We will also have to know which XML document or which nodes in XML documents we are going to use for re-generating content. TEI Publisher uses the <code>pb-view</code> component for this. <code>pb-view</code>s are defined in the HTML templates that TEI Publisher uses to organize the page. They listen to a <code>pb-document</code> component to know what document they have to process, they can make a selection from that document using an XPath expression and they can refer to a specific ODD in order to select certain PM definitions. A behaviour such as <code>pb-view</code> (or a behaviour-like thing) is definitely needed to support interaction in the TEI PM. </para>
        </section>
        <section>
            <title>Further interaction settings</title>
            <section>
                <title>Lazy or eager execution</title>
                <para>For behaviours whose display is optional, it will usually be possible to tie their display to the state 
                    of a user interface component. If we think of the tabbed display used in the 
                    <link xlink:href="https://vangoghletters.org" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Van Gogh edition</link>, the panel to be displayed depends 
                    on the state of the tabselector above the panels (<xref linkend="figvg"/>). In those cases, 
                    an implementation of the TEI PM will know that certain content is not needed in the initial 
                    display of the page. In other cases, it may be desirable to be able to explicitly indicate 
                    to the implementation that processing steps should be postponed until certain content is 
                    needed. And there will also be UI functionality whose display is not dependent on a specific 
                    state of a widget, e.g., most popups. For a complicated popup, we might also want to be able 
                    to provide a directive that its preparation should wait until the popup is requested.</para>
                <figure xml:id="figvg">
                    <title>Tabs in Van Gogh Letters</title>
                    <mediaobject>
                        <imageobject>
                            <!--<imagedata fileref="Bal2026boot092501.png" format="png" width="300px"/>-->
<imagedata fileref="../../../vol31/graphics/Boot01/Boot01-001.png" format="png"/>
                        </imageobject>
                    </mediaobject>
                </figure>
                <para>To indicate this situation to the implementation, it might be useful to add to the TEI <code>model</code> element an extra attribute <code>loadpreference</code>, with the values <code>eager</code> or <code>lazy</code>. The value <code>eager</code> directs the implementation to generate the content immediately; the value <code>lazy</code> means the generation should wait; without the attribute, the implementation is free to decide what seems most appropriate. </para>
                <para>Theoretically, we could also use a <code>param</code> with name <code>loadpreference</code> rather than a <code>model</code> attribute. 
                An attribute is more appropriate, I believe, because the <code>param</code>s will only be evaluated when the decision to 
                    process a <code>model</code> has already been taken. An attribute can be evaluated before processing the <code>model</code>.</para>
            </section>
            <section>
                <title>Immediate or deferred execution</title>
                <para>Whereas the distinction between <code>eager</code> and <code>lazy</code> execution refers to the generation of a behaviour's 
                    own content, the distinction between <code>immediate</code> and <code>deferred</code> execution is relevant to behaviour widgets
                    that govern the display of other behaviours. Suppose, for example, we have a widget that determines the sort
                    order on our edition's persons overview page. When the user changes the desired order, is that to be 
                    effectuated immediately or only on the next page refresh? </para>
                <para>I propose an extra <code>param</code> on the behaviour that defines the widget. The parameter name could be <code>effective</code>, its permitted 
                    values <code>immediate</code> or <code>deferred</code>. In this case the setting is only relevant if the behaviour is generated,
                    so there is no need to define an extra attribute for the <code>model</code> element. </para>
            </section>
            <section>
                <title>Maintaining settings</title>
                <para>For widgets that allow users to choose certain settings for a display, we can ask another question. 
                How permanent should these settings be? For instance, if we choose a text rendering that signals deletions and 
                additions in the text, do we want that choice to be applied to the next text that we open? Do we want it to 
                be applied when we come back to the text the following day? This can be indicated in another parameter, 
                which we might call <code>duration</code>. 
                Appropriate values could be <code>page</code>, <code>session</code>, <code>browser</code>, and <code>user</code>.
                The value <code>user</code>, in editions that have no login feature, would have the same effect as the 
                value <code>browser</code>.</para>
            </section>
        </section>
    </section>
    <section>
        <title>Proposed behaviours</title>
        
        <para>Many of the questions that I have brought up above obviously need more discussion. One of the purposes 
            of this paper is to get that discussion started. To provide some concrete food for thought, 
            I propose the following behaviours: <code>conditional-highlight</code>, <code>facs-link</code>, 
            <code>i18n</code>, <code>language-control</code>, <code>margin-text</code>, 
            <code>sort-control</code>, <code>sort-order</code>, <code>toggle</code>.</para>
        
        <para><emphasis>conditional-highlight</emphasis>: 
            The <code>conditional-highlight</code> behaviour is a minimal version of TEI Publisher's <code>pb-highlight</code>. It accepts the 
            <code>param</code>s <code>additionalCSSClass</code> (that describes the highlighting), <code>key</code> (elements with the same key will be 
            highlighted), <code>duration</code> (duration of the highlight, in milliseconds), and <code>trigger</code> 
            (<code>click</code> or <code>mouseover</code>). It can be activated in the following way:<footnote>
                <para>In the TEI PM, <code>param</code> is an empty element. The code samples in this section use text 
                    content in <code>param</code>, as proposed in <link xlink:href="https://github.com/TEIC/TEI/issues/2770" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">TEI GitHub issue 2770</link>, and 
                    <code>model</code> elements in <code>param</code>, as 
                    proposed in <link xlink:href="https://github.com/TEIC/TEI/issues/2771" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">TEI GitHub issue 2771</link>.</para>
            </footnote></para>
        
<programlisting language="xml" xml:space="preserve">
&lt;model behaviour="paragraph"&gt;
    &lt;param name="conditionalHighlight"&gt;
        &lt;model behaviour="conditionalHighlight"&gt;
            &lt;param name="additionalCSSClass"&gt;highlightclass&lt;/param&gt;
            &lt;param name="key" 
                value="concat('para',tokenize(@xml:id,'\.')[last()])"/&gt;
            &lt;param name="duration"&gt;1500&lt;/param&gt;
            &lt;param name="trigger"&gt;mouseover&lt;/param&gt;
        &lt;/model&gt;
    &lt;/param&gt;
&lt;/model&gt;
</programlisting>

        <para><emphasis>facs-link</emphasis>: 
            The <code>facs-link</code> behaviour is inspired on TEI Publisher's <code>pb-facs-link</code>. 
            Unlike <code>pb-facs-link</code>, it cannot, as yet, 
            send data about a region to be highlighted in the image; it just sends the URL of 
            the facsimile to be displayed to the facsimile behaviour. It accepts the parameters <code>url</code> 
            and <code>content</code>. </para>
        
        <para><emphasis>i18n</emphasis>: 
            The <code>i18n</code> behaviour is inspired on TEI Publisher's <code>pb-i18n</code>. 
            It subscribes to changes in the <code>language-control</code> 
            behaviour and when these occur, it changes the language of its text content to the new language.
            Currently it accepts 
            <code>content</code> and <code>language-control</code> params. The <code>language-control</code> param, 
            which points to the <code>language-control</code> behaviour, 
            is probably superfluous. I should add a <code>param</code> for the <code>key</code> to be used in the translation 
            table.<footnote><para>Currently it uses as key  
                    the text content in English with spaces replaced by underscores.</para></footnote>
        </para>
        
        <para><emphasis>language-control</emphasis>: 
            The <code>language-control</code> behaviour is inspired on TEI Publisher's <code>pb-lang</code>. At the moment, 
            the implementation provides the information about languages that should be available. A parameter 
            should be added to provide that information from the processing model.<footnote>
                <para>I would not be in favour of allowing the edition creator to provide the code 
                    for an HTML <code>select</code>, as does <code>pb-lang</code>. HTML choices should be left to the implementation.</para>
            </footnote></para>
        
        <para><emphasis>margin-text</emphasis>: The margin-text behaviour has no equivalent in TEI Publisher. It can be used for paragraph numbers, line numbers, etc. 
            It might also have been realised as an option on, for example, the 
            <code>paragraph</code> behaviour, but a behaviour of its own seemed cleaner. Its invocation can look like this:</para>
        
<programlisting language="xml" xml:space="preserve">
&lt;elementSpec ident="p"&gt;
    &lt;model behaviour="paragraph" 
            predicate="ancestor::tei:text" cssClass="para-plus-num"&gt;
        &lt;param name="paranum"&gt;
            &lt;model behaviour="margin-text" 
                    cssClass="margin" conditional="yes"&gt;
                &lt;param name="content" value="string(@n)"/&gt;
                &lt;param name="displayiff"&gt;
                    &lt;epm:property 
                            part-id="showparanum" name="checked"/&gt;
                &lt;/param&gt;
            &lt;/model&gt;
        &lt;/param&gt;
    &lt;/model&gt;
&lt;/elementSpec&gt;
</programlisting>
        
        <para>The <code>epm:property</code> (<code>epm</code> refers to the namespace for the Edition Publication Model) refers to 
            the <code>checked</code> property of the widget with id <code>showparanum</code>.<footnote>
                <para>We stumble upon a problem here: how do we assure the widget <emphasis>has</emphasis> a <code>checked</code> 
                    property? The control that it points to is created in a <code>toggle</code> behaviour, and if the implementation 
                    chooses to use an HTML checkbox for that purpose, it will have a <code>checked</code> property. But the implementation 
                    is not obliged to use specific HTML elements. So maybe it becomes necessary  
                    to specify in behaviour definitions not just the <code>param</code>s they accept but also the properties that they 
                    expose to other behaviours.</para>
            </footnote> That widget is created by the <code>toggle</code> behaviour (see below).</para>

        <para><emphasis>sort-control and sort-order</emphasis>:
            The <code>sort-control</code> has no equivalent in TEI Publisher. Its only parameter at the moment is <code>id</code>. 
            <code>block</code> behaviours that are to be sorted can refer to the <code>id</code>. 
            The <code>sort-control</code> creates a 
            drop-down list with the sort orders as defined on the referring <code>block</code>. <code>sort-order</code> as a behaviour has 
            already been proposed in <link xlink:href="https://github.com/TEIC/TEI/issues/2773" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">TEI 
                GitHub issue 2773</link>. That issue suggests we can leave it to the implementation to 
            generate the sort-control. To have better control over the location of the 
            sort-control, I now propose a separate behaviour. The <code>sort-control</code> 
            behaviour is simple: </para>
        
<programlisting language="xml" xml:space="preserve">
&lt;model behaviour="sortcontrol"&gt;
    &lt;param name="id"&gt;sortselect&lt;/param&gt;
&lt;/model&gt;
</programlisting>
        
        <para>The <code>sort-order</code> behaviour can be specified (repeatedly) as a parameter on the 
            <code>block</code>s that are to be sorted. 
        The specification can have the form of the example below. Here we specify three possible orderings 
        for an element. Each ordering is provided with a <code>label</code> (for the drop-down box) 
            and a <code>key</code> for the sort-order. </para>
        
<programlisting language="xml" xml:space="preserve">
&lt;model behaviour="block"&gt;
    ....
    &lt;param name="sortcontrol"&gt;sortselect&lt;/param&gt;
    &lt;param name="ordering"&gt;
        &lt;modelSequence&gt;
            &lt;model behaviour="sort-order"&gt;
                &lt;param name="label"&gt;Date&lt;/param&gt;
                &lt;param name="key" 
                    value="string(analyze-string(tei:date/text(),
                        '\d{4}')/*[local-name()='match'][1]/text())"/&gt;
                &lt;param name="default" value="true()"/&gt;
            &lt;/model&gt;
            &lt;model behaviour="sort-order"&gt;
                &lt;param name="label"&gt;Illustration number&lt;/param&gt;
                &lt;param name="key" 
                    value="substring-before(
                        substring-after(
                            ./tei:head[@xml:lang='en'],'Ill. '),')')"/&gt;
            &lt;/model&gt;
            &lt;model behaviour="sort-order"&gt;
                &lt;param name="label"&gt;Title&lt;/param&gt;
                &lt;param name="key" 
                    value="substring-before(
                        ./tei:head[@xml:lang='en'],' (')"/&gt;
            &lt;/model&gt;
        &lt;/modelSequence&gt;
    &lt;/param&gt;        
&lt;/model&gt;
</programlisting>
        
        <para><emphasis>toggle</emphasis>:
            The <code>toggle</code> behaviour is inspired on TEI Publisher's <code>pb-toggle-feature</code>. However, 
            <code>pb-toggle-feature</code> (in its client-side version) toggles by setting a CSS class. The <code>toggle</code> 
            behaviour that I propose here governs the behaviour of other behaviours that subscribe to it. (We saw above
            how the <code>margin-text</code> behaviour stated how its display depended on the state of  a 
            <code>toggle</code> behaviour with <code>id</code> <code>showparanum</code>.)</para>
        
        <para>These behaviours have all been implemented in the Edition Publication Model.<footnote>
                <para>The implementation of the Edition Publication Model
            generates static HTML on the basis of Processing Model definitions and some additional settings. The implementation 
            is not meant to be attractive or usable for the creation of real editions. Its only aim is to check 
            whether the proposed constructs can actually be implemented.</para></footnote> 
            The behaviours can be seen at work in the 
            <link xlink:href="https://peterboot.nl/epm/israelsletters/" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Isaac Israëls letter demo</link>. The demo is based 
            on these 
            <link xlink:href="https://gitlab.huc.knaw.nl/edition-publication-model/edition-publication-model/-/tree/main/recreate-israels" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">PM 
                definitions</link> and has been generated by this 
            <link xlink:href="https://gitlab.huc.knaw.nl/edition-publication-model/edition-publication-model/-/tree/main/implementation" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">implementation</link>.
        </para>
    </section>
    <section>
        <title>Conclusion and coda</title>
        
        <para>We have seen that specifying interaction is, on various levels, more complicated than specifying static publications. There exists a great variety of interactive behaviours, and it is unlikely that at a first attempt we get everything right. Accordingly, I have ended this paper with a number of possible interactive behaviours; experimentation is probably the right approach. We're fortunate in being able to build on the work already done in TEI Publisher.</para>
        <para>On a personal note: I started working with digital editions and XML in 1999. A few years later I began 
            to think about a declarative specification for edition publication functionality, but that always remained 
            at the level of speculation. Only with the advent of the TEI Processing Model a declarative specification 
            began to seem feasible. And it took a few more years of incubation before I understood that. Now, 
            I'm close to the age of retirement and finally working out these ideas. I also, finally, feel 
            I may have something to contribute at Balisage—and apparently only just in time.</para>

        <figure xml:id="fighc1">
            <title>Gartner Hype Cycle 1999</title>
            <mediaobject>
                <imageobject>
                   <!-- <imagedata fileref="Bal2026boot092502.png" format="png" width="300px"/> -->
<imagedata fileref="../../../vol31/graphics/Boot01/Boot01-002.png" format="png"/>
                </imageobject>
            </mediaobject>
        </figure>
        <figure xml:id="fighc2">
            <title>Gartner Hype Cycle 2000</title>
            <mediaobject>
                <imageobject>
                  <!--  <imagedata fileref="Bal2026boot092503.png" format="png" width="300px"/> -->
<imagedata fileref="../../../vol31/graphics/Boot01/Boot01-003.png" format="png"/>
                </imageobject>
            </mediaobject>
        </figure>
        <figure xml:id="fighc3">
            <title>Gartner Hype Cycle 2001</title>
            <mediaobject>
                <imageobject>
                  <!--  <imagedata fileref="Bal2026boot092504.png" format="png" width="300px"/> -->
<imagedata fileref="../../../vol31/graphics/Boot01/Boot01-004.png" format="png"/>
                </imageobject>
            </mediaobject>
        </figure>
        
        <para>When I joined the XML world, XML was, according to the Gartner hype cycle, just beyond the 'peak 
            of inflated expectations' (<xref linkend="fighc1"/>). In 2000 it was on the 'slope of enlightenment' 
            (<xref linkend="fighc2"/>) and in 2001 it had already progressed so much on the 'plateau of 
            productivity' that it had dropped out of the picture (<xref linkend="fighc3"/>). 
            At least, that is how I interpret its absence from the figure. Apart from 
            following my heart I had also, apparently, made a sensible decision careerwise. But since 
            then, XML seems to have lost the attention of the world. I've sat through a number of 
            presentations on digital edition conferences where someone argued, based on statistics 
            from StackExchange, that XML was no longer hot and that we should switch to something else. 
            And indeed, when I search on Google Scholar for terms relevant to this project, 
            I tend to be shown publications from the early 2000's or even before.</para>
        <para>Still, as long as people keep writing and reading, and therefore publishing, 
            we'll need some form of markup. All word processor documents are XML documents 
            internally. XML is no longer that hot, but how hot are, say, relational 
            databases? And as long as we'll have the web, we'll have HTML, and 
            XML will be just around the corner. I'm not too pessimistic about the future 
            of markup languages.</para> 

    </section>
    
    <bibliography>
        <title>Bibliography</title>
        <bibliomixed xml:id="boot2024" xreflabel="Boot 2024">
            Boot, Peter. <quote>The TEI Processing Model: Introduction, limitations and potential extensions</quote>. 
            In <emphasis>Proceedings Declarative Amsterdam</emphasis>. 2024. [Cited 31 March 2026]. 
            doi: <biblioid class="doi">10.1075/da.2024.boot.tei-processing-model</biblioid>.  
        </bibliomixed>
        <bibliomixed xml:id="bootxxxx" xreflabel="Boot [under review]">
            Boot, Peter. <quote>An edition publication specification for the TEI</quote> [under review]. 
        </bibliomixed>
        <bibliomixed xml:id="tei2026" xreflabel="TEI Consortium 2026">
            TEI Consortium.  
            <emphasis>Guidelines for Electronic Text Encoding and Interchange</emphasis>, Version 4.11.0. 2016. [Cited 31 March 2026]. 
            <link xlink:href="https://tei-c.org/release/doc/tei-p5-doc/en/html/" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">link</link>. 
        </bibliomixed>        
        <bibliomixed xml:id="helms2009" xreflabel="Helms et al. 2009">
            Helms, James, Robbie Schaefer, Kris Luyten, Jean Vanderdonckt, Jo Vermeulen, Marc Abrams. eds. 
            <emphasis>User Interface Markup Language (UIML)</emphasis>,  Version 4.0. Committee Specification 01.
            2009. [Cited 31 March 2026]. 
            <link xlink:href="http://docs.oasis-open.org/uiml/v4.0/cs01/uiml-4.0-cs01.pdf" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">link</link>. 
        </bibliomixed>        
        <bibliomixed xml:id="turska2016" xreflabel="Turska, Cummings &amp; Rahtz 2016">
            Turska, Magdalena, James Cummings, Sebastian Rahtz. <quote>Challenging the myth of presentation in digital editions</quote>. 
            In <emphasis>Journal of the Text Encoding Initiative</emphasis>, vol 9. 2016. [Cited 31 March 2026]. 
            doi:<biblioid class="doi">10.4000/jtei.1453</biblioid>.  
        </bibliomixed>
    </bibliography>
    
</article>