[relaxng-user] position conditional patterns
Bruce D'Arcus
bdarcus at fastmail.fm
Fri Mar 25 11:52:29 ICT 2005
One of the great things about working with RELAX NG is that pretty much
anything I dream up, I can represent in the language.
However, I've just thought of something I'd like to do that I'm not sure
is possible, or if it is, how to do it.
Here's what I want to do:
I have a citation style language. Among other things, it works as a
simple template system for citations and bibliographies.
What I want to do is to have the sorting logic use the first child of a
given element (cs:reftype) as the first option on sort. The second
option ought to be indicated via an attribute on that element.
So, for an article, it might be:
<reftype="article">
<creator alternate-sort-key="container-title">
The above key would then map to an xpath expression (that indicates a
periodical title), where the options would be defined in the schema.
Is there some way for me to say in RNG that this first child may contain
the "alternate-sort-key" attribute? Would the only way to do this be to
have patterns like:
Creator = element creator { whatever }
Creator-First = element creator { whatever, SortKeyAttribute }
First = Creator-First | Title-First
Reftype = element reftype { First, Rest }
Rest = Creator | Title | Date
?
Bruce
More information about the relaxng-user
mailing list