Relax NG tricky issue ...

[email protected] ("Mezzophanti") Wed, 3 Nov 2004 16:22:13 +0800
Newsgroups php.xml.dev
Message-ID <[email protected]>
Okies,

Always one to try and push specs beyond their possibilities - I've bumped up 
against another nasty.

*Apologies if this is the wrong forum - redirect me with prejudice as 
required*

I love Relax NG's ambiguity and some of the things this allows - expecially 
relating to context-sensitive data modeling.

Such as having:

   <attribute name="length"><value>1</value></attribute>
   <data type="string"><param name="maxLength">1</param></data>

as a group within a series of such groups (with the numbers changing to 2,3 
and so on to whatever)

This allows the maxLength facet to be preset according to whatever value the 
xml document records for the attribute:

<myelement length="3">abc</myelement> would therefore validate, whereas:
<myelement length="3">abcD</myelement> would not (because it has four 
characters)

Now ... using this value-based method of context-sensitivity is fine when 
you know how many value aspects there are (for example if length can be 
between 1 and 20 inclusive) Buuuuut - not if the number is indeterminant OR 
if the number is excessively large.

Is there ANY other method around this that brains out there know of?

Such as:

   <attribute name="length"><value>X</value></attribute>
   <data type="string"><param name="maxLength">X</param></data>

where X (or whatever syntax we use to reference it) is AUTOMATICALLY set to 
be the same in each position.

This way, we are basically using only 2 lines to say that WHATEVER value is 
given to a length attribute will automatically set that attribute's element 
maxLength to THAT value.

Clear?

Does the compact syntax have an ability to forward reference like this?

Thoughts? Ideas? :)

Any and all thoughts welcome ...

Mezzophanti