[examplotron] Re: [relax-ng] trang instance input module

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Thu Jan 30 2003 - 10:38:33 UTC

On Thu, 2003-01-30 at 10:59, James Clark wrote:
> > About Examplotron, I plan to add some additional features to get to the
> > 80/20 point (probably including simple types, control over attributes,
> > mixed contents and interleave) and then "import" the RNG patterns in the
> > Examplotron namespace for users who would like to stay with Examplotron
> > for the remaining 20%.
> This seems like a good approach to me. I think there should be a
> bidirectional mapping between RNG and Examplotron: any RNG schema should be
> straightforwardly transformable into Examplotron. By "importing" the RNG
> patterns, you almost get this. I think the only missing thing would be the
> ability to do annotation elements. One way to solve this would be to add
> an eg:annotation element to Examplotron:
> <eg:annotation>
> <anyNonRelaxNGElement>...</>
> <eg:annotation>

Yes. Other options would be to declare a list of namespaces used for
annotations or to add a "eg:annotation" attribute in elements used as
> which would be transformed into RNG simply by removing the eg:annotation
> attribute.
> As for the 80%, I would want:
> a) Control over whether an attribute is required or optional. One approach
> would be to have 3 attributes: an inherited attribute saying whether
> attributes are by default required or optional; an attribute that lists the
> names of attributes that are optional for this element (when the default is
> required); an attribute that lists the names of attributes that are
> required for this element (when the default is optional).

Yes. Another option which is commonly used to add structure to
attributes is to transform them into elements. To say that attribute
"bar" is optional, we could write:

 <bar eg:node="attribute" eg:occurs="?"/>

The content of the attribute could also be used, for instance:

 <foo bar="occurs=?"/>

The first option would be more easily extensible, for instance to add
information about the datatype:

 <bar eg:node="attribute" eg:occurs="?" eg:type="xsd:integer"/>

The second option would lead to more complex stuff such as:

 <foo bar="occurs=?, type=xsd:integer"/>

I don't know how far we need to go since people wanting a good control
could always use the RNG alternative and write:

  <eg:attribute name="bar">
   <eg:data type="xsd:integer"/>

> b) Datatyping. This is crucial but I don't immediately see a good design.
> It would be nice to be able to write:
> <th align="left|center|right" valign="middle|top|bottom" colspan="Number"
> rowspan="Number" abbr="Text">
> ...
> </th>
> and have it turn into:
> element th {
> attribute align { "left" | "center" | "right" }?,
> attribute valign { "middle" | "top" | "bottom" }?,
> attribute colspan { Number },
> attribute rowspan { Number },
> attribute abbr { Text }
> ...
> }

Yes. This would lead to more or less embed a subset of the compact
syntax into attributes (or elements). It could be handy but I wonder if
this would be easy to learn.
> On the other hand, in some cases it might be preferable to stick to a purer
> example metaphor:
> <th align="left" valign="middle" colspan="2" rowspan="2" abbr="any old
> text">
> ...
> </th>
> But then you need some way to specify a mapping from example values into
> datatypes, and that starts to get complicated for the user. One way might
> be to point to a file containing a list of datatype definitions (ordered
> from least general to most general), and you use the first one that matches
> the example value. This would be hard to implement in pure XSLT though.
> One thing I think is important if users are going to maintain there schemas
> in Examplotron: I think they need be able to conveniently reference
> definitions not just builtin datatypes.

Yes. One option would be rely on RNG elements and could lead to
something such as:


 <foo eg:ref="foo-content"/>

 <eg:define name="foo-content">
  <eg:data type="xsd:integer">
   <eg:param name="minInclusive">5</eg:param>


Thanks for your suggestions!


> James

If you have a XML document, you have its schema.
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
Received on Thu Jan 30 11:38:49 2003

This archive was generated by hypermail 2.1.8 : Fri Dec 03 2004 - 14:29:47 UTC