[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [BULK] [xsl] Sorting a TEI bibliography by

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 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.
        <title>Mooses Come Walking</title>
            <forename>Arlo</forename> <surname>Guthrie</surname>
            <forename>Alice</forename> <surname>Brock</surname>
          <publisher>Chronicle Books</publisher>
          <pubPlace>San Francisco</pubPlace>
          <date when="1995"/>
      <idno type="ISBN">0-8118-1051-8</idno>
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
> 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
> level="m">Neo-Confucian Terms Explained</title><imprint><pubPlace>New
> York</pubPlace><publisher>Columbia University
> Press</publisher><date>1986</date></imprint></monogr></biblStruct>
> <biblStruct
> 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
> 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

Current Thread