Kohsuke's interpretation of the semantics is not what I meant, but I
certainly don't want to suggest a confusing syntax either. I did not mean to
imply any sort of recursion. What I meant in this example is at least two
and no more than 10.
<min count="2">
<max count="10">
<element name="product"><text/></element>
</max>
</min>
In RELAX NG, we have tended to "say it" with elements, rather than
attributes. That was why I am throwing around <min> and <max>. You may want
to specify a minimum count of occurrences, and you don't care about a
maximum. Just use <min>. Or you may only care about maximum; just use <max>.
You want both minimum and maximum? Use both <min> and <max>. That's my idea.
If we go with something like <repeat>, I'd prefer the element name <occurs>
instead, as in:
<occurs min="2" max="10">
<element name="product"><text/></element>
</occurs>
If people like <repeat min='' max=''>, then what kept us from adopting it
early? I don't recall.
Kohsuke KAWAGUCHI wrote:
> This doesn't make sense to me. I suppose the semantics of
>
> <max count="n">
> p
> </max>
>
> is "p can be repeated up to n times"
>
> and similarly the semantics of <min> would be "p must be repeated at
> least n times."
>
> If so, it should be allowed to repeat <product> 20 times in the
> following example:
>
> > <min count="2">
> > <max count="10">
> > <element name="product"><text/></element>
> > </max>
> > </min>
>
> since that the outer <min> says is that you can repeat <product>*10 up
> to 2 times. I guess this is not what you want.
>
> So I think it needs to be something like <repeat min="n" max="m"> as
> we've discussed in the very early days of RELAX NG.