Thank you, Angel Syd.
I find your angina-inducing alternation of attribute lists very nifty,
and also illuminating. On the other hand, as you imply, I'm afraid that
pushing this solution at the Council (as part of a larger proposal)
could be a recipe for defeat.
So I will examine the pure solution closely now, and will try to
implement it tonight. What I was afraid of, there, was the potential
complexity (and the ensuing error-proneness) of the Schematron. But the
way you do it, with `castable` and a direct reference to the data type,
it looks a lot less painful than I expected.
Wow, thank you so much again!
On 23/03/17 18:42, Syd Bauman wrote:
> I tihnk the short answer is "no", Pure ODD can't do that. But to be
> honest, I haven't tried. This is in part because I know the `roma`
> code that handles <attList org="choice"> is broken. (See bug 144.)
> But ODD can do this, albeit in a roundabout, hack kind of way. (And,
> it turns out in writing my test, I had to add a hack to the hack to
> get around what I presume is a bug in ODD processing.)
> The attached ODD is an example of a method that at best is likely to
> be considered controversial, at worst bad practice. But it does
> exactly what (I think) you want. It re-names the element <hi> to be
> <methodOne>, and gives it three new required
> attribute.1 = "pointer" | "character" | "byte_offset" | "time_in_sec"
> attribute.2 = anyURI nonNegInt nonNegInt int
> attribute.3 = anyURI nonNegInt nonNegInt int
> A few caveats, in no particular order:
> * The method used will give some people angina.
> * Because RELAX NG cosntructs are used directly, you do not have the
> advantage that the value of attribute.3 is defined as
> teidata.pointer when attribute.1 is "pointer"; rather, it is
> defined directly as anyURI.
> * Hack: I had to use <rng:interleave> to group the attribute
> definitions; for some reason when I tried <rng:group> (which is
> what one would naturally expect to use) `roma` converted it to an
> * I really doubt you can get usable XSD, and you certainly can get
> helpful DTD, out of this.
> So personally, I prefer the solution you recommended: just create a
> closed list for @attribute.1, and then a small Schematron rule to
> ensure that @attribute.2 and @attribute.3 are of the right datatype.
> I have thrown that into the ODD as well, renaming <emph> to be
> <methodTwo>, and giving it three new required attributes named
> "anotherAtt.1" etc.
>  https://github.com/TEIC/Stylesheets/issues/144
>> I would like to define an alternation of patterns of up to three
>> attributes, where the datatype of attribute.2 and attribute.3 is uniform
>> and depends on the value of attribute.1.
>> Something like the following (in **pseudo-markup**):
>> <rng:group> "pointer", data.pointer,
>> data.pointer </rng:group>
>> <rng:group> "character", data.nonNegativeInteger,
>> data.nonNegativeInteger </rng:group>
>> <rng:group> "byte_offset", data.nonNegativeInteger,
>> data.nonNegativeInteger </rng:group>
>> <rng:group> "time_in_sec", data.integer,
>> data.integer </rng:group>
>> .... etc.
>> I could do that in RNG, but can I do that in ODD as well?
>> If I understand correctly, ODD expects me to list the three attDef
>> declarations in an <attList> for my new class, and to declare a new data
>> type that groups the data types that I need for attribute.2 and
>> attribute.3, and to make the value of attribute.1 a closed list, and
>> then to slam a huuuge piece of Schematron onto this (hopefully inside
>> this very class definition; I haven't checked that) that would attempt
>> to rule out unwanted sequences.
>> Is my diagnosis correct? I probably wouldn't mind being wrong.
>> I also admit to having a rather hazy idea of the extent of the
>> difference in "staticness" between listing potential patterns in an RNG
>> schema on the one hand, and defining them in the ODD on the other. I
>> mean, I am not really sure if I could <alternate> a series of
>> <sequence>s containing <attDef>s. Would I end up defining a single
>> attribute several times? Would/Should ODD allow me to do that?