[tei-council] Macro.anyXML

Hugh Cayless philomousos at gmail.com
Tue Oct 27 23:01:15 CET 2015

Ok, I think I understand this now, and will attempt to prove it by trying to explain it in simple language.

Macro.xnyXML permits any text or XML content, apart from anything in the TEI or TEI Examples namespaces. By permitting anything, it implicitly defines @xml:id with whatever content you’d like. If your ODD adds a new element (say, e.g. foo:bar, @xmlns:foo="http://example.com <http://example.com/>"), and that element is allowed to have @xml:id, then there is an extra definition of @xml:id on <foo>, because macro.anyXML would permit, e.g.

	<foo:bar xml:id="any bloody thing"/>

and that would be just fine, except @xml:id is defined as an ID on <foo:bar>, so there’s a conflict. This didn’t flag up any tests before, because macro.anyXML only showed up in tagdocs. But now it’s in tei, and so it’s much, much easier to make an ODD that does this, and we accidentally did make a couple.

So the solution, well, "a" solution is for any ODD that adds new namespaces and allows @xml:id on their elements to also exclude that namespace from macro.anyXML. Then it’s no longer implicitly defining a non-ID @xml:id for <foo:bar>. There might be some clever way of doing this automatically in the Stylesheets ODD processing, I suppose. Other solutions occur to me, but they aren’t very palatable.

Something like:

<macroSpec xmlns="http://www.tei-c.org/ns/1.0" type="pe" ident="macro.anyXML" module="tei"
  <desc versionDate="2008-09-05" xml:lang="en">defines a content model within which any XML
    elements are permitted</desc>
  <desc versionDate="2009-07-16" xml:lang="fr">définit un modèle de contenu dans lequel tous
    les éléments XML sont autorisés.</desc>
    <element xmlns="http://relaxng.org/ns/structure/1.0">
          <nsName ns="http://www.tei-c.org/ns/1.0"/>
          <nsName ns="http://www.oucs.ox.ac.uk/ns"/>
          <name ns="http://www.tei-c.org/ns/Examples">egXML</name>
          <ref name="macro.anyXML"/>

added to https://github.com/TEIC/Stylesheets/blob/master/Test/test30.odd <https://github.com/TEIC/Stylesheets/blob/master/Test/test30.odd>, which is the Stylesheets test that was giving me headaches (note https://github.com/TEIC/Stylesheets/blob/master/Test/test30.odd#L94 <https://github.com/TEIC/Stylesheets/blob/master/Test/test30.odd#L94>), fixes the validation error. I don’t think there’s a general solution, but at least we can tell people how to deal with it if it pops up in their ODDs.

More information about the tei-council mailing list