Thanks.
However, I was looking to utilize one of Relax NG Compact's abilities to redefine elements. Your example is a workable solution, but these two elements are just one pair among many that I want to write, and writing out the complete definition for each context would get pretty tiresome.
I know about the include directive and its ability to redefine elements, but what I'm fuzzy on is how to redefine an element in as efficient a manner as possible.
For example, let's say I have the following named patterns (capitalized for easy identification):
- Code: Select all
Courses = element courses {
Course+
}
Course = element course { course.attlist }
course.attlist =
attribute dept {text}?,
attribute number {text},
attribute credits {xsd:nonNegativeInteger}?,
attribute grade {xsd:string{minLength="1" maxLength="2"}}?,
attribute title {text}?,
attribute description {text}?
Now, according to the Relax NG Compact tutorial, there's a way to say "everything but" by
using a minus operator. Then there is also
the notAllowed keyword.
But whenever I try to use either, the validator lights up with errors. (And as although I am very happy with Oxygen, the errors for RNG Compact files don't explain the problem at all. I know RNG Compact isn't XML, but it's designed to be 1-to-1 compatible with XML, which should theoretically allow the editor to provide more helpful tooltips…)
So continuing the example above, what I would like to do is something sort of like the following… (this is invalid, but I'm just trying to communicate what I'm trying accomplish)
- Code: Select all
Courses = element courses {
(
attribute dept {text},
Course {attribute dept = notAllowed}+
) |
Course+
}
Course = element course { course.attlist }
course.attlist =
attribute dept {text}?,
attribute number {text},
attribute credits {xsd:nonNegativeInteger}?,
attribute grade {xsd:string{minLength="1" maxLength="2"}}?,
attribute title {text}?,
attribute description {text}?