sorting question

cross-posting here …

I’m working on sorting configuration, but am running into a fundamental
design question:

When dealing with reference lists, is the first field always the sort
key?

For example, in a typical reference list, the creator name will be the
sort key. If there is no creator, there needs to be rules to specify
substitutes. For a book, it might be to substitute the phrase
"Anonymous." For an article, it might be to substitute the periodical
title.

In a cite key style citation class, likewise, it seems the sort key is
the citation key; e.g.:

[doe99] Doe, J. …

Is this a reliable general rule then? Or should instead the layout and
the sorting be seen as completely separate?

I’m leaning towards a structure like:

It’s possible for me to do some RELAX NG magic and condition the layout
of the following elements based on the sort-key value, but I’m not sure
I should do that or not.

The other issue I’ve not resolved is how to handle CDATA, though one
solution is to have:

creator container-title creator Anonymous

Bruce