[relaxng-user] position conditional patterns

Bruce D'Arcus bdarcus at fastmail.fm
Fri Mar 25 15:32:32 ICT 2005


Bruce D'Arcus wrote:

 > Bob Foster wrote:
 >
 >> The design does seem a little peculiar. The sort keys are actually 
keys on refType. Why doesn't the refType element specify both the 
primary and alternate sort keys and get this order-dependence out?
 >
 >
 >
 > That might indeed be the way to go. I wonder if you have a suggestion 
on a related issue?  In some cases, the alternate sort key would map to 
an element, but in other cases it would just be text.
 >
 > For example:
 >
 > <reftype name="book" sort-key="creator" alternate-sort-key="Anonymous">


Actually, there is one problem introduced by this approach. The main 
sort key is always going to be the first child.  So unless I jump 
through some hoops, the following would be valid, even if not "correct":

<reftype name="book" sort-key="creator" alternate-sort-key="Anonymous">
   <title/>
   ...
</reftype>

With the other approach I can just say implicitly that the first child 
is the main sort key, and then have patterns like:

Book = element reftype { attribute name {"book"}, First, Subsequent }
First = Creator-First
Creator-First = element creator { attribute alternate-sort-key { x }}

Bruce


More information about the relaxng-user mailing list