[xsl] Sorting a TEI <biblStruct> bibliography by <surname>

Subject: [xsl] Sorting a TEI <biblStruct> bibliography by <surname>
From: "Charles Muller acmuller@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 20 Jul 2014 11:25:59 -0000

Using TEI-P5 <biblStruct> format, I'm trying to sort a bibliography by surname. Some sample entries are like this (such that <surname> falls under varying paths):

<biblStruct xml:id="Buswell-1989"><monogr><author><surname>Buswell</surname><forename>Robert E., Jr.</forename></author><title level="m">The Formation of Ch'an Ideology in China and Korea</title><imprint><pubPlace>Princeton</pubPlace><publisher>Princeton UP</publisher><date>1989</date></imprint></monogr></biblStruct>

<biblStruct xml:id="Chan-1967a"><monogr><editor role="editor"><surname>Chan</surname><forename>Wing-tsit</forename></editor><title level="m">Neo-Confucian Terms Explained</title><imprint><pubPlace>New York</pubPlace><publisher>Columbia University Press</publisher><date>1986</date></imprint></monogr></biblStruct>

<biblStruct xml:id="Chien-1988"><analytic><author><surname>Ch'ien</surname><forename>Edward T.</forename></author><title level="a">The Neo-Confucian Confrontation with Buddhism: A Structural And Historical Analysis</title></analytic><monogr><title level="j">Journal of Chinese Philosophy</title><imprint><biblScope type="vol">15</biblScope><date>1988</date><biblScope type="pages">347b348</biblScope></imprint></monogr></biblStruct>

My code for handling <biblStruct> has been working fine for a number of years, but I just recently tried to add the sort by <surname>. The relevant part of the code looks like this (including my most recent attempt at sorting, which generates error messages):

<!-- Bibliographical renderings --> <xsl:template match="TEI//listBibl"> <xsl:for-each select="biblStruct"> <xsl:sort select="*//surname"/> <p style="text-indent:-10mm;margin-left:10mm"> <xsl:if test="@n"> <span style="font-weight:bold;margin-left:2mm"> <xsl:value-of select="@n"/> <xsl:text>-&#x09;</xsl:text> </span> </xsl:if> <xsl:apply-templates/> </p> </xsl:for-each> </xsl:template>

Any advice would be greatly appreciated. Once I get this working, I'd also like to do a second sort, based on the <title>. This is to get output in Chicago Full Note style.




A. Charles Muller

Graduate School of Humanities and Sociology
Faculty of Letters
University of Tokyo
7-3-1 HongE
, BunkyE
Tokyo 113-8654, Japan

Office Phone: 03-5841-3735

Web Site: Resources for East Asian Language and Thought

Twitter: @H_Buddhism

Current Thread