[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Sorting a TEI <biblStruct> bibliography by <surnam

Subject: Re: Sorting a TEI <biblStruct> bibliography by <surname>
From: "Syd Bauman s.bauman@xxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 20 Jul 2014 12:42:51 -0000
Re:  Sorting a TEI <biblStruct> bibliography by <surnam
 1. I don't think I ever got Charles Muller's original post. When was
    it sent?

 2. Charles -- I presume you are using XSLT 2.0, since there is no
    prefix for the TEI namespace in your XPaths, and because the main
    element is listed as "TEI", not "TEI.2". But aloways a good idea
    to post to the list exactly what version of XSLT and even what
    processor you are using.

 3. As Martin says, we'll need to see what the error message is. Your
    code works for me. (Or at least, doesn't generate error msgs. :-)

 4. Presuming your <monogr>, <series>, or <analytic> elements have
    <surname>s that have content somewhere inside 'em, I don't see
    anything wrong with your code off the top of my head. 

 5. That said, I generally prefer to apply templates than use
    for-each. Presuming you have multiple <listBibl> elements and need
    to keep them separately sorted (which you current code will do),
    I'd use something like

  <!-- Bibliographical renderings -->
  <xsl:template match="TEI//listBibl">
    <xsl:apply-templates select="biblStruct">
      <xsl:sort select="(
  <xsl:template match="biblStruct">
    <p style="text-indent:-10mm;margin-left:10mm">
      <xsl:if test="@n">
        <span style="font-weight:bold;margin-left:2mm">
          <xsl:value-of select="concat( @n, '-&#x09;' )"/>
   Note that I've been much more precise in *which* surname to use for
   sorting, because in my bibliographies <surname> might appear inside
   something other than <author> or <editor> (it is used, e.g., in
   explanatory <note>s). I've also combined the "@n" and hard-coded
   text into one <xsl:value> just because.

 6. Hope this helps! If it doesn't, probably a good idea to post the
    entire stylesheet and a chunk of sample input wiht several
    <biblStruct>s, and the error message. (And which version of XSLT
    and which processor.)

> > 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>
> Which errors exactly do you get?

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.