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

Subject: Re: [BULK] [xsl] Sorting a TEI <biblStruct> bibliography by <surname>
From: "Syd Bauman s.bauman@xxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 20 Jul 2014 14:06:21 -0000
Your code works for me, Charles. (I'm running it as XSLT 2.0 using
Saxon-HE 9.5.1.3J on the commandline.)

HOWEVER, the select= attribute of your <xsl:sort> will try to select *all*
of the <surname> descendants of each child of each <biblStruct>. If
there is more than one, you will get "max 1 item allowed on
xsl:sort/@select" or some such. E.g.
    <biblStruct>
      <monogr>
        <title>Mooses Come Walking</title>
        <author>
          <persName>
            <forename>Arlo</forename> <surname>Guthrie</surname>
          </persName>
        </author>
        <respStmt>
          <resp>illustrator</resp>
          <persName>
            <forename>Alice</forename> <surname>Brock</surname>
          </persName>
        </respStmt>
        <imprint>
          <publisher>Chronicle Books</publisher>
          <pubPlace>San Francisco</pubPlace>
          <date when="1995"/>
        </imprint>
      </monogr>
      <idno type="ISBN">0-8118-1051-8</idno>
    </biblStruct>
dies with that kind of message. (Besides, even if it worked, it would
sort differently depending on whether <author> or <respStmt> happened
to appear first, which is fragile. And yes, Alice Brock is the
"Alice" of _Alice's Restaurant_.)

> 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>Rob
ert
> 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>Edwa
rd
> 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.
>
> Regards,
>
> Chuck
>
>
>
>
> --
>
> ---------------------------
> A. Charles Muller
>
> Graduate School of Humanities and Sociology
> Faculty of Letters
> University of Tokyo
> 7-3-1 HongE
, BunkyE
-ku
> Tokyo 113-8654, Japan
>
> Office Phone: 03-5841-3735
>
> Web Site: Resources for East Asian Language and Thought
> http://www.acmuller.net
>
> Twitter: @H_Buddhism
>

--
 Syd Bauman, EMT-Paramedic
 Senior XML Programmer/Analyst
 Northeastern University Women Writers Project
 s.bauman@xxxxxxx or
 Syd_Bauman@xxxxxxxxxxxxxxxx

Current Thread