-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Labels
Description
XPath expressions are often insufficient to specify values for model parameters, particularly when the value needs to be fetched from elsewhere by id.
Let's analyze the case of anchor elements with @xml:id to which stand-off notes point to. The content of the note for the anchor must be retrieved by id from the listAnnotation part of the document. In the example below (fragment of the actual teipublisher.odd) the parameter value is expressed as XQuery FLWOR expression, otherwise we would have variable scope problems in the listAnnotation/note[@target=$target] part of the expression
<elementSpec ident="anchor" mode="change">
...
<model predicate="@type='note'" behaviour="note">
<desc>Process notes with @type=note (assuming the note is stand off,
in the listAnnotation section in the same document)</desc>
<param name="content" value="let $target := '#' || @xml:id return root($parameters?root)//listAnnotation/note[@target=$target]/node()"/>
<param name="label" value="let $target := '#' || @xml:id return root($parameters?root)//listAnnotation/note[@target=$target]/@n/string()"/>
</model>
<model predicate="@xml:id" behaviour="anchor">
<param name="id" value="@xml:id"/>
</model>
</elementSpec>I would postulate to change the specification for https://tei-c.org/release/doc/tei-p5-doc/en/html/ref-param.html in the following way:
- adjust gloss from
provides a parameter for a model behaviour by supplying its name and an XPath expression identifying the location of its contenttoprovides a parameter for a model behaviour by supplying its name and an XQuery expression to compute its value. - adjust gloss for
@valuein Attributes section tosupplies an XQuery expression which when evaluated provides the value for the parameter - Remove the
Literal strings provided in the value expression should be quoted.from the Note section - Adjust the first example description which currently reads
In this example, which will be processed for a `choice` element which has both `sic` child elements, the default parameter will provide the value of the child `corr` element, and the alternate parameter will provide that of the child `sic` elements. If neither `param` element was supplied, both elements would still be available to an application, but the application would need to distinguish them for itself.
to
In this model example, which would be applicable for any `choice` element which has both `sic` and `corr` child elements, the default parameter will be evaluated the child `corr` element, and the alternate parameter will be evaluated to the child `sic` elements.
Reactions are currently unavailable