Oops, I left out the sort. It should be:
<xsl:for-each select="//TitleWork ">
<xsl:sort select="roles[1]/Name-Role[1]/party[1]/@xl:title" data-type="text" order="ascending"/>
<c01 level="file">
<did>
<unittitle><xsl:value-of select="roles[1]/Name-Role[1]/party[1]/@xl:title"/></unittitle>
...[etc. whatever]
</did>
</c01>
</xsl:for-each>
-----Original Message-----
From: Encoded Archival Description List [mailto:[log in to unmask]] On Behalf Of Michele Rothenberger
Sent: Monday, August 27, 2012 1:43 PM
To: [log in to unmask]
Subject: Re: XSLT: Sort and copy all source records into resulting document
No, you shouldn't need to process them twice. In the sample I sent, I just had code to output the title so I could see that it worked, but you could just as easily replace that with
<xsl:for-each select="//TitleWork ">
<c01 level="file">
<did>
<unittitle><xsl:value-of select="roles[1]/Name-Role[1]/party[1]/@xl:title"/></unittitle>
...[etc. whatever]
</did>
</c01>
</xsl:for-each>
and it should output them in the order you want.
Michele
---- Marsha Maguire <[log in to unmask]> wrote:
> Hi, Michele and anyone else who might be interested,
>
> Michele, re. my XSLT emails of last week and your kind replies: I want
> to convert all the source TitleWork records in my source file to EAD
> <c01> entries. The finding aid will describe a collection that
> consists of sound recordings of interviews. I want those <c01>
> descriptions presented in order by the surname of the main person (or
> name of the musical group) interviewed, and that info is in (here's the full path):
>
> /mavis/TitleWork/roles/Name-Role[1]/party[1]/@xs:title [I hadn't
> thought to filter both Name-Role and party to the first instance of
> each - thank you!]
>
> If I sort the TitleWork "records" in the same stylesheet that converts
> them to EAD <c01> descriptions, will I need to process the <TitleWork>
> elements a second time? E.g.,
>
> <xsl:for-each select="//TitleWork">
> <c01 level="file">
> <did> ...
>
> I thought that wasn't possible unless the "mode" attribute was used
> with either xsl:template or xsl:apply-templates. I'm leery of
> xsl:apply-templates because it sets off the default templates, and
> really, I don't want most of the elements in each source TitleWork
> record in the resulting EAD. The source TitleWork records as exported
> from our collections management system is over 500 lines long; I'm
> just using a few elements and attributes from the source in the
> resulting <c01> entries. Of course, the stylesheet I wrote to try to
> sort *and* copy over the full exported source document also processes
> some elements twice, right? Which is probably why it isn't working, either -- ?
>
> Thanks again, so much.
>
> Marsha Maguire
|