Is it possible to write an XSL stylesheet to flatten the controlled access terms? We'd like to shift from encoding like this:

<controlaccess>
<head>Search Terms</head>
<note>
<p>The following terms have been used to index the description of this collection in
the American Jewish Archives's online catalog.</p>
</note>
<controlaccess>
<head>Contributors</head>
<persname source="lcnaf" encodinganalog="700" />
</controlaccess>
<controlaccess>
<head>Subjects</head>
<persname encodinganalog="600" source="lcnaf" />
<corpname encodinganalog="610" source="lcnaf" />
<subject source="lcsh" encodinganalog="650" />
<occupation encodinganalog="656" source="lcsh" />
<geogname encodinganalog="651" source="lcnaf" />
</controlaccess>
<controlaccess>
<head>Genres</head>
<genreform encodinganalog="655" source="lcsh">LCSH</genreform>
</controlaccess>
</controlaccess>

to this:

<controlaccess>
<head>Search Terms</head>
<note>
<p>The following terms have been used to index the description of this collection in
the American Jewish Archives's online catalog.</p>
</note>
<persname source="lcnaf" encodinganalog="700" />
<persname encodinganalog="600" source="lcnaf" />
<corpname encodinganalog="610" source="lcnaf" />
<subject source="lcsh" encodinganalog="650" />
<occupation encodinganalog="656" source="lcsh" />
<geogname encodinganalog="651" source="lcnaf" />
<genreform encodinganalog="655" source="lcsh" />
</controlaccess>
</controlaccess>

And let the HTML/PDF stylesheets do the sorting. Alas, I have about 800 finding aids encoded in the former example that need to be converted. Any help would be much appreciated!

Many thanks,
Nathan