TEIC / TEI

The Text Encoding Initiative Guidelines
https://www.tei-c.org
Other
274 stars 88 forks source link

ability to define new element with same name as an existing #209

Closed TEITechnicalCouncil closed 8 years ago

TEITechnicalCouncil commented 14 years ago

I want to incorporate islands of distinct markup in a TEI document, in their own namespace. Unfortunately, one of the elements has the same name as an existing TEI one. If I pull in the external namespace as a RELAX NG schema, I can use a pattern prefix in the TEI to avoid the conflict, but this precludes making DTDs and getting integrated documentation, so I'd like to pull in (using XInclude) the external scheme using ODD (luckily, its already written in ODD). But now I cannot distinguish the external <term> from the TEI <term> (for it is this element which is the evil one).

I'd like to get around this by making two changes to ODD: a) add a "prefix" attribute to <elementSpec>, parallel to the one on <schemaSpec>, to allow us to determine the pattern name generated b) add a boolean attribute to <content> to determine whether references therein (RELAX NG <ref>) are able to be changed by having prefixes added automatically (as the TEI processor normally) does

I am not 100% sure this is the most elegant solution, but I do think that we need to cater for this situation.

Original comment by: @sebastianrahtz

TEITechnicalCouncil commented 8 years ago

This issue was originally assigned to SF user: louburnard Current user is: lb42

TEITechnicalCouncil commented 14 years ago

Original comment by: @lb42

TEITechnicalCouncil commented 14 years ago

It's not hugely important, but what name would you propose for the attribute on <content>?

A sample elementSpec showing the proposed markup would be useful.

Original comment by: @DavidSewell

TEITechnicalCouncil commented 14 years ago

I am using <content preserveNames="true"> at the moment

Original comment by: @sebastianrahtz

TEITechnicalCouncil commented 14 years ago

Here is a complete example, where we define an element <descripGrp> which needs to refer to the TBX element <note> which clashes with TEI's <note>. The user has to know that the prefix "tbx_" has been assigned to <note>.

<elementSpec xmlns:rng="http://relaxng.org/ns/structure/1.0" prefix="tbx_" mode="add" ns="http://www.lisa.org/TBX-Specification.33.0.html" ident="descripGrp"> <desc>Contains one <gi>descrip</gi> element as well as additional child elements for associated administrative information.</desc> <classes> <memberOf key="id"/> </classes> <content preserveNames="true"> <rng:ref name="tbx_descrip"/> <rng:zeroOrMore> <rng:choice> <rng:ref name="tbx_descripNote"/> <rng:ref name="tbx_admin"/> <rng:ref name="tbx_adminGrp"/> <rng:ref name="tbx_transacGrp"/> <rng:ref name="tbx_note"/> <rng:ref name="tbx_ref"/> <rng:ref name="tbx_xref"/> </rng:choice> </rng:zeroOrMore>

</content> </elementSpec> <elementSpec xmlns:rng="http://relaxng.org/ns/structure/1.0" prefix="tbx_" mode="add" ns="http://www.lisa.org/TBX-Specification.33.0.html" ident="note"> <desc>Any kind of note. </desc> <classes> <memberOf key="idlang"/> </classes> <content preserveNames="true"> <rng:ref name="tbx_entity.noteText"/> </content> </elementSpec>

Original comment by: @sebastianrahtz

TEITechnicalCouncil commented 14 years ago

After discussion at Council of the various varyingly unsatisfactory proposals described in Sebastian's email of 2010-04-07 [ 1) change all the TEI sources so that all names have a prefix of "TEI_", and one must always use this. DOWNSIDE - existing ODDS break, big time.

2) allow for a @prefix attribute in various place to generate a prefix for generated patterns, and allow use of that to distinguish "condition" from "condition". In this case, we have to know whether a name contains a prefix, so we have to (eg) disallow "-" from names of things and use it as a prefix separator, or pick up a new character like &middot; DOWNSIDE: messy and confusing.

3) enhance the RELAX NG <ref> with a TEI-specific alternative supporting a namespace declaration, and generate appropriate patterns at compile time. DOWNSIDE: we lose the ablity to validate the contents of <content> against the RELAXNG schema ]

The further suggestion was made of adding an extra attribute -- in the TEI namespace -- to the <rng:ref> element when this appears within the TEI <content> element e.gf.

<content> <rng:oneOrMore> <rng:ref name="blort" tei:prefix="foo"/> </rng:oneOrMore> </content>

Default value would be set for @prefix depending on the @source from which the <blort> was being taken.

This seemed preferable to any of the others, if feasible.

Original comment by: @lb42

TEITechnicalCouncil commented 14 years ago

After further discussion, it seems that the least worst solution is (b) below: we add an attribute @autoPrefix to <content> with default value "true" which indicates whether or not the element names it references are to be auto-prefixed when the corresponding Relaxng fragment is generated. This attribute is only visible in the small number of cases where a name collision would otherwise be likely whereas other solutions affect everyone.

Original comment by: @lb42

TEITechnicalCouncil commented 14 years ago

Issue Bedroom,even light appeal this mother behaviour cover instrument location division fruit concentration session treatment buy worker coffee background draw white crisis supply different would aye there like easily beyond football district size southern paint supply thin power late area plate recognition nose once lay allow twice component question outside away totally might region know league tour plus heat fee village recently plus once that possible provided university carry difficult if reflect trend someone outcome contribution manner include share magazine direct pattern requirement climb crowd kid busy way

Original comment by: nobody

TEITechnicalCouncil commented 14 years ago

Issue Bedroom,even light appeal this mother behaviour cover instrument location division fruit concentration session treatment buy worker coffee background draw white crisis supply different would aye there like easily beyond football district size southern paint supply thin power late area plate recognition nose once lay allow twice component question outside away totally might region know league tour plus heat fee village recently plus once that possible provided university carry difficult if reflect trend someone outcome contribution manner include share magazine direct pattern requirement climb crowd kid busy way

Original comment by: nobody

TEITechnicalCouncil commented 14 years ago

This task is now complete, I believe, wiith the addition of @autoPrefix to <content> and @prefix to <elementSpec>

Original comment by: @sebastianrahtz

TEITechnicalCouncil commented 14 years ago

Original comment by: @sebastianrahtz