[examplotron] Attributes: have it both ways

From: Jonathan Lang <[email protected]>
Date: Wed Nov 05 2003 - 05:26:39 UTC

There's a drawback to defining an attribute's type within the attribute:
it gets in the way of using the schema as an instance document. For
instance, if I were to write a schema which includes something to the
effect of

   <a href="{xsd:url}">A link</a>

I would be unable to feed said URL into a web browser and actually _use_
the link - as I have no way to specify what URL we're supposed to go to.
As such, we really ought to have an alternative method for explicitly
specifying an attribute's type. Said approach needs to be intuitive in
its syntax, something along the lines of:

   <a href="http://examplotron.org" eg:content.href="xsd:url">A link</a>

(I use a period in "eg:content.href" because AFAIK the XML namespaces
standard forbids the use of more than one colon in a name. It's probably
just as well; the above is probably more readable than "eg:content:href"
would be.)

IOW, 'name="{datatype}"' would be exactly equivelent to
'name="..." eg:content.name="datatype"' - the former being more compact,
the latter being less intrusive. Use the former when you don't really
need the sample document to be a fully functional document, and use the
more verbose latter when you do.

This approach can be extrapolated: any of the Examplotron attribute
annotations could in theory be made to apply to an attribute instead of an
element by appending the target attribute's name to the annotation's name,
seperated by a period: 'name="value" eg:define.name='label'", for
instance. In practice, however, this works better in some cases
('content' and 'define') than in others ('assert' and 'occurs'): In the
case of 'assert', it has already been pointed out that Schematron rules
(upon which 'assert' is based) can't be applied directly to attributes.

In the case of 'occurs', only the '.' and '?' options are appropriate for
use with attributes - and since '?' is the default, you might be better
off using a new 'required' attribute which takes a whitespace-seperated
list of attribute names which cannot be left out. Nonetheless, either
approach would be sufficient to render the <eg:attribute> element
unneccessary.

=====
Jonathan "Dataweaver" Lang

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
Received on Wed Nov 5 06:26:53 2003

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