If I understand you correctly, you're asking for the ability to define a
context-dependent content model, e.g. such that <p> as a descendant of
<teiHeader> might have a different content model from <p> as a
descendant of <text>. (Your mail talks about <div> as a child of
<teiHeader> but that's not legal at all, so I am assuming you meant <p> !)
This is certainly something we have discussed as a useful addition to
the ODD language, but it hasn't been implemented yet. The syntax
proposed was to add a @context attribute to the <content> element, but
this hasn't been done yet. Processing that into RelaxNG wouldn't be
hard, since as you suggest, there's at least one nice implementation
strategy; for DTD this is just impossible; for W3C Schema, I don't know,
but since we generate our W3C schemas from Relaxng that may not matter.
The TEI Simple ODD includes a set of Schematron rules designed to
prevent child elements which are permitted in the Header from appearing
in the <body>. They appear as <constraintSpec>s, like other Schematron
rules, and are processed as such by the current stylesheets, so that
oXygen will certainly flag any such elements as errors: I am not sure
what you mean by "automatic completion of element names" in this context.
On 22/06/16 17:14, Gioele Barabucci wrote:
> in ODD, how can I change the constraints of the <div> elements that
> appear in a certain position (e.g., /TEI/text/body) while using the
> default definition for all the other elements?
> I could specify those constraints as a set of Schematron assertions,
> but those would not be picked up by, for example, oXygen for the
> automatic completion of element names and attribute values.
> In RelaxNG one can give two different definitions of <div>: one for
> those elements appearing in a certain production, and another for all
> the others contexts. Can the same thing be done in ODD?
> The use case for this request is that I would like <div>s in
> /TEI/text/body to contain only few whitelisted elements, while
> allowing <div> in other places (mainly the header) to be unconstrained.
> Note: Element names and element definitions are separate entities in
> RelaxNG; in ODD it looks like element names and their definitions
> cannot be separated (I suppose this has to do with DTD support).
> Probably this means that what I am looking for cannot be done, but I
> think it is worth asking anyway.