[xsl] Sorting a TEI list of biblFull with the date as descendant of the author element

Subject: [xsl] Sorting a TEI list of biblFull with the date as descendant of the author element
From: chiara@xxxxxxxxxxx
Date: Fri, 28 Mar 2014 13:57:53 +0000
I am using Oxygen and XSLT 2.0.
My TEI/XML file is a succession of biblFull elements, which needs to be sorted
via the attribute of the date element descendant of the author element. I
should add that there are more then one element with the same author name and
attribute n and with the same date and attributes.
I think I realise that I need to sort select with the attribute of the date
element, but at the moment I am struggling to figure out which element I need
to sort, the biblFull or the titleStmt?
<text>
        <body>
            <div type="bibliography">
                <biblFull>
                    <titleStmt>
                        <title xml:id="b56">La Priparation
Ivangilique/Preparatio Evangelica</title>
                        <author n="Eusebius">Eusebius Theologus et Scriptor
Ecclesiasticus<date when="0004">A.D. 4</date></author>
                        <editor>Iduard des Places, s.j.</editor>
                    </titleStmt>
                    <publicationStmt>
                        <publisher>Les Idition du Cerf</publisher>
                        <pubPlace>Paris</pubPlace>
                        <address><addrLine>29, Bd de Latour
Mauburg</addrLine></address>
                        <date>1980</date>
                        <availability><p>Copyright 1980, Les Idition du
Cerf</p></availability>
                    </publicationStmt>
                    <seriesStmt>
                        <title>Sources Chritiennes</title>
                        <biblScope>n.266</biblScope>
                    </seriesStmt>
                </biblFull>
I only managed to create a sort with this XSLT, but I do not sort the entire
biblFull, only the date and the author
<xsl:template match="/">
        <html>
            <head>

                <link rel="stylesheet" type="text/css" href="finale.css"/>
            </head>
            <body bgcolor="azure">
                <div id="centeredmenu">
                <ul>
                    <li>
                        <a href="Odyssey finale.html" target="_self">Home</a>
                    </li>
                    <li>
                        <a href="Bibliography secondary sources.html"
target="_self">Indirect
                            Tradition Bibliography</a>
                    </li>
                    <li>
                        <a href="scholialista.html"
target="_self">Scholia</a>
                    </li>
                    <li>
                        <a href="ManuscriptsBookI.html"
target="_self">Manuscripts Book I</a>
                    </li>
                    <li>
                        <a href="#GeneralIntroduction">General
Introduction</a>
                    </li>
                    <li>
                        <a href="#Dowmnloads">Downloads</a>
                    </li>
                    <li>
                        <a href="#Contacts">Contacts</a>
                    </li>
                </ul>
                    </div>
                <p>
                    <xsl:value-of select="div[@bibliography]"/>
                    <xsl:apply-templates select="descendant::author[@n]">

                        <xsl:sort
select="descendant::date[@when,@cert,@intant,@notAfter,@notBefore]"/>
                        <xsl:sort
select="descendant::author[substring-after(@n, '#')]"/>
                        <xsl:sort
select="@when,@cert,@intant,@notAfter,@notBefore"/>
                        <xsl:sort select=" substring-after(@n, '#')"/>

                   </xsl:apply-templates>
                    <xsl:apply-templates/>
                </p>

                <div class="single">
                    <iframe src="single authors.html" name="single"
height="600" width="500"
                        />
                </div>
            </body>
        </html>
    </xsl:template>
The last thing I tried to do is to sort inside a biblFull, but I did not
manage to achieve anything.
<xsl:template match="biblFull">
        <table border="0">
            <xsl:for-each select="descendant::titleStmt">
                <xsl:apply-templates select="descendant::title[@xml:id]"/>
                <xsl:apply-templates select="descendant::title[@sameAs]"/>
                <xsl:apply-templates select="descendant::author[@n]">
                    <xsl:sort select="descendant::date[substring-after(@when,
'#')]"/>
                    <xsl:sort select="descendant::date[substring-after(@cert,
'#')]"/>
                    <xsl:sort
select="descendant::date[substring-after(@instant, '#')]"/>
                    <xsl:sort
select="descendant::date[substring-after(@notAfter, '#')]"/>
                    <xsl:sort
select="descendant::date[substring-after(@notBefore, '#')]"/>
                </xsl:apply-templates>
                <xsl:apply-templates select="descendant::editor"/>
                </xsl:for-each>
            <xsl:for-each select="publicationStmt">
                    <xsl:apply-templates select="publisher"/>
                    <xsl:apply-templates select="pubPlace"/>
                    <xsl:apply-templates select="address"/>
                    <xsl:apply-templates select="date"/>
                    <xsl:apply-templates select="availability"/>
                </xsl:for-each>
            <xsl:for-each select="seriesStmt">
                <xsl:apply-templates select="title"/>
                <xsl:apply-templates select="biblScope"/>
            </xsl:for-each>
        </table>
    </xsl:template>
Thanks.
Chiara Salvagni

Current Thread