Greetings to the list,

And thanks to a number of you who answered my questions about getting started with XSLT stylesheets, both on the list and through email. Thanks especially to John Bewley, whose MARC-to-EAD stylesheet I was able to customize and use to convert MARC records for sound recordings into EAD <c02>-level descriptions, and to Mike Ferrando for offering help on the final product. And to Mark Carlson, who basically wrote a stylesheet I used to convert records exported from a local collections management database into component-level EAD descriptions -- and also walked me through how it worked. Thank-you to Michael Fox and Michele Combs for always offering their expertise; aren't archivists the best?

This is starting to sound like an awards show.  :-)  But I really do appreciate everyone's help. I've encountered a problem I can't solve, though (I've tried many different approaches with no success), so I have another question. When I export an XML file of records from our collections management database (developed by a company that's now out of business), I need to sort the many records in the exported XML file before converting them to EAD descriptions. The exported records are very long and complex, so I thought the best way to sort them would be to do an identity transform -- copy all the records in full to the resulting document -- but sort those copied records by the first personal or corporate name in each record. I can't figure out how to do that, simple as it seems. Here's a snippet of the exported source doc. Each "record" is defined by <TitleWork> tags (each TitleWork element set will be converted to an EAD <c01>).

<?xml version="1.0" encoding="UTF-8"?>
<mavis xmlns:xl="" objectCount="10" exportLimit="0">
        ...[a lot of elements here]...
                <party xl:href="/Name/key/2708" xl:title="Smith, John"/>
                <role xl:href="/Code/key/ROLE//INE" xl:title="Interviewee">INE</role>
                <party xl:href="/Person/key/279613-1" xl:title="Johnson, Joe"/>
                <role xl:href="/Code/key/ROLE//INE" xl:title="Interviewee">INE</role>
... [more TitleWork records here] ...

Sometimes there are 3-4 //party elements in a TitleWork record; I want to sort the complete XML document of records by the name in each TitleWork record's first party element/@xl:title attribute  (i.e., sort on the value of //party[1]/@xl:title). Here's one of my failed stylesheets. I've tried <xsl:for-each> for sorting, too -- no luck.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="" version="1.0"
    <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="no"></xsl:output>
    <xsl:strip-space elements="*"></xsl:strip-space>
    <xsl:template match="@*|node()">
            <xsl:apply-templates select="@*|node()"></xsl:apply-templates>
    <xsl:template match="//TitleWork">
            <xsl:sort select="//party[1]/@xl:title"></xsl:sort>
Any help deeply appreciated! Many thanks.

Marsha Maguire