Me too, but I'd rather not be wagged at all On 27/04/18 23:07, Martin Holmes wrote:
We shouldn't let the tail (RELAXNG) wag our dog, methinks.
Haven't we been doing precisely that with DTDs for years? I'd rather be wagged by RELAXNG than DTD.
On 2018-04-27 02:28 PM, Lou Burnard wrote:
RELAXNG allows references to atributes in content because it considers both attributes and elements alike as patterns. In ODD we tend to think that elements and attributes are different kinds of beast. We shouldn't let the tail (RELAXNG) wag our dog, methinks.
On 27/04/18 22:24, Syd Bauman wrote:
Yup. Glad you pointed that out. Because it is not insane, even if a bad idea, to allow references to attributes in <content>. That's how RELAX NG handles it.
This: | <content> | <alternate minOccurs="1" maxOccurs="1"> | <classRef key="att.datable.iso" include="when-w3c"/> | <dataRef name="xs:date"/> | </alternate> | </content> makes perfect sense to me, and can be represented in RELAX NG as: | ( att.datable.w3c.attribute.when | xsd:date )
No reason, I don't think, that the plurals or <sequence> wouldn't work, either, but that would be a heavy load on the Stylesheets.[1]
Notes ----- [1] Note that in RELAX NG, "att.datable.w3c.attribute.when*" is valid, but "xsd:date*" is not. I guess that's because RELAX NG knows that an attribute cannot be repeated, but does not know how to repeat a string. (Need to use the 'list' construct if you want to repeat a string.)
I think #3 is interesting:
3. content/descendent::classRef[ starts-with( @key, 'att.') ]
If a classRef appears within an alternate[@maxOccurs="1"], then presumably it _should_ mean that the element would either have those attributes, or it would allow another descendant element, but not both. That would be kind of useful, although horrible to process, and presumably better achieved with Schematron.