First I would like to publicly to thank Wendell, Michael, Sebastian,
and other XSLT answer-providers.
Second, though, I have a question or concern about Wendell's proposed
solution (copied here with slightly different whitespace indentation,
and using id() instead of key()):
This seems odd to me; to process the who= in order to output a
specialized label (what TEI calls a <speaker> :-) when you hit the
first <p> child of <sp>, rather than when you hit the <sp> itself.
Even if we ignore the argument that when the Justices start speaking
in verse that <p> will be an <l> or <lg>, isn't the test for the
existence of a preceding sibling unnecessarily complicated? I'm
wondering if Occam's Razor doesn't suggest something like the
Ah, but now I see the light. (It's amazing how actually doing the
work illuminates what perhaps should have been obvious.) My solution
forces the label to be in its own <html:p> element, whereas Wendell's
permitted it to be the first text in the first <html:p>, which will
likely look look a lot better in most cases.
Of course, one could man-handle my solution above to add a
class="first" to the first <html:p> that was derived from a <tei:sp>,
and then CSS style this all to look right, but the XSLT code to do
that would be at least as complicated as Wendell's, most likely
moreso. So there. Wendell was right all along. I'll bet no one is
surprised. I'm not.