Page 1 of 1

define combine="interleave"

Posted: Thu Apr 08, 2010 9:12 pm
by anayram
I think there might be a problem with RelaxNG's combine="interleave" pattern in Oxygen.

I defined a "common" schema that contains element definitions used both in schemas "A" and "B". For schema B, I need to redefine a pattern called "narrow-inclusion" (already defined in "common") by allowing the occurrence of three new elements, but XML documents ONLY allow for those three new elements (as if I had replaced the definition, instead of combining by interleave. Below is an example:

In the "common" schema I did the following:

Code: Select all

<define name="narrow-inclusion">
<zeroOrMore>
<choice>
<ref name="A-element"></ref>
<ref name="B-element"></ref>
</choice>
</zeroOrMore>
</define>
And in "B" I redefined "narrow-inclusion" and defined new elements C and D below include (not copied here):

Code: Select all

<include href="common.rng">
<define name="narrow-inclusion">
<zeroOrMore>
<choice>
<ref name="C-element"></ref>
<ref name="D-element"></ref>
</choice>
</zeroOrMore>
</define>
</include>
But XML documents that use B as a schema only allow for C and D. Any help will be greatly appreciated.

Cheers,
Mariana

Re: define combine="interleave"

Posted: Thu Apr 08, 2010 9:14 pm
by anayram
My apologies, the second example should read:

Code: Select all

<include href="common.rng">
<define name="narrow-inclusion" [b]combine="interleave"[/b]>
<zeroOrMore>
<choice>
<ref name="C-element"></ref>
<ref name="D-element"></ref>
</choice>
</zeroOrMore>
</define>
</include>
Thanks!
Mariana

Re: define combine="interleave"

Posted: Sun Apr 11, 2010 10:46 pm
by george
When you overwrite a pattern inside an include then the old pattern is removed. See
http://relaxng.org/spec-20011203.html#IDAG3YR
If the include element has a define component, then the grammar element must have a define component with the same name. For every define component of the include element, all define components with the same name are removed from the grammar element.
You should place the combine pattern as a sibling of the include element, not as a child. Thus you will get both patterns in your grammar.

Best Regards,
George

Re: define combine="interleave"

Posted: Tue Apr 13, 2010 10:37 pm
by anayram
Thank you very much, this solved the issue.

Cheers,
Mariana