Thanks to Sebastian's help, I was able to feed Roma an ODD specification
file that generated a Relax NG schema which permits an XHTML table
(<html:table>) to be used in the same context as a standard TEI table
element.  I needed to hand-tweak a couple of things; details follow for
anyone else who want to try this.

First, I used the online Roma to generate a simple ODD template file
containing the default modules plus "figures". I edited this file by
hand to add an additional <moduleRef> element to the <schemaSpec> element:

    <moduleRef url="">
	<rng:define name="tei_model.inter" combine="choice">
	  <rng:ref name="table"/>
	<rng:define name="tei_model.common" combine="choice">
	  <rng:ref name="table"/>

where the URL in the first line points to James Clark's modularized
RelaxNG schema for XHTML.  Then, using a command-line version of Roma,
I ran

   roma --patternprefix=tei_ --nodtd --noxsd myTei.odd Schema/

This generated a well-formed RelaxNG schema called MyTei.rng, with
"tei_" prefixed to all the TEI definitions as promised.

myTei.rng as generated had two minor problems:

 * the includes from the remote xhtml.rng were given as relative
   filesystem files, not as HTTP URLs. This prevented Roma from
   generating a compact .rnc file and also caused a validation error
   with myTei.rng.  Fix: either hand-edit myTei.rng to provide the
   correct URLs for included modules, or copy all the files to the local
   filesystem before running Roma.  (But shouldn't Roma be smart enough to
   realize that a relative inclusion when the base URL is an HTTP call
   needs to be rewritten to add the full URL info?)

 * myTei.rng still wouldn't validate, throwing the error "Multiple definitions of
   start without 'combine' attribute". Diagnosis: the modules included via
   the <moduleRef> element themselves contained an <rng:start> element. Fix:
   add "combine='choice'" by hand to the <rng:start> element generated by Roma.
   (Again, should Roma be smart enough to do this? Or should my ODD file
   have redefined <rng:start>?)

That done, the resulting myTei.rng validates both a standard TEI
document and one that uses HTML-style tables! And the oXygen editor
knows where html:table is permitted and does auto-completion on all the
XHTML elements and attributes. Very nice.

On Mon, 1 May 2006, Sebastian Rahtz wrote:

> David Sewell wrote:
> > I've just been attempting to create an ODD file that will produce a P5
> > schema that will allow html:table (i.e., 'table' in the XHTML namespace)
> > anywhere that a TEI-namespace table is permitted. But I'm not quite
> > clear on how to add an element from another namespace. I tried something
> > along
> > the lines of
> >
> >   <elementSpec module="figures" ident="html:table" mode="add">
> >
> > (having defined the 'html' prefix and included a RelaxNG version of
> > the XHTML schema), but Roma doesn't seem to like prefixed element names.
> > What am I missing here?
> I am afraid its not as simple as it might be. What you have to do is
> locate a Relax NG grammar for XHTML (let's call it xhtml.rng) and then
> massage TEI patterns by hand. Thus:
>       <moduleRef url="">
>       	<content>
> 	  <rng:define name="model.inter" combine="choice">
> 	    <rng:ref name="html.table"/>
> 	  </rng:define>
> 	</content>
>       </moduleRef>
> so
>  a) <moduleRef>'s @url loads an external file of Relax NG code
>  b) <moduleRef> has an optional <content> child whose contents are
>     injected into the final schema.
>  c) you have to add to one of the TEI class patterns. we modify class.inter.
> What's wrong with this? Something serious - the pattern which identifies
> the HTML table element in xhtml.rng is actually "table", which is
> identical to the name in TEI. So in the example above I have used
> "html.table", which would mean changing the XHTML RNG file. Names of
> things in Relax NG are NOT name-spaced, unfortunately.
> If this isn't making sense, please shout!

David Sewell, Editorial and Technical Manager
Electronic Imprint, The University of Virginia Press
PO Box 400318, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: [log in to unmask]   Tel: +1 434 924 9973