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

Re: Sorting a TEI list of biblFull with the date as d

Subject: Re: Sorting a TEI list of biblFull with the date as descendant of the author element
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxx>
Date: Fri, 28 Mar 2014 10:26:13 -0400
Re:  Sorting a TEI list of biblFull with the date as  d
Chiara,

As I understand it, your question, "do I need to sort, the biblFull or
the titleStmt?", is one we can't answer. This is part of your
requirements specification.

Sort the biblFull elements if you want your bibliography presented in
order of the date given in its entries. Sort the titleStmt if you
expect your biblFull to have more than one titleStmt (will this ever
happen?), and you want their titles sorted by their author dates when
the bibliography is given (in document order).

I think you probably want your bibliography sorted, no?

Wouldn't this be something like (in your template matching the root):

<xsl:apply-templates select="div[@type='bibliography']/biblFull">
  <xsl:sort select="descendant::author/date/@when"/>
  (etc.)

BTW, the <xsl:value-of select="div[@bibliography]"/> will do nothing
useful, probably nothing at all: it generates a node containing the
string value of a div child (of the matched node, i.e. the root) with
a @bibliography attribute. Such a div is nowhere to be found, as a
child of the root or otherwise.

In general, I think you'll find it is easier to solve this problem if
you reduce it to a smaller one. Rather than adding code that might
(you hope) do what you want, delete everything that doesn't solve this
particular problem (i.e. the order of presentation), solve it, then
build the code back up by adding what else you need.

Cheers, Wendell

On Fri, Mar 28, 2014 at 9:57 AM,  <chiara@xxxxxxxxxxx> wrote:
> 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 PrC)paration
C	vangC)lique/Preparatio Evangelica</title>
>                         <author n="Eusebius">Eusebius Theologus et Scriptor
Ecclesiasticus<date when="0004">A.D. 4</date></author>
>                         <editor>C	duard des Places, s.j.</editor>
>                     </titleStmt>
>                     <publicationStmt>
>                         <publisher>Les C	dition du Cerf</publisher>
>                         <pubPlace>Paris</pubPlace>
>                         <address><addrLine>29, Bd de Latour
Mauburg</addrLine></address>
>                         <date>1980</date>
>                         <availability><p>Copyright 1980, Les C	dition du
Cerf</p></availability>
>                     </publicationStmt>
>                     <seriesStmt>
>                         <title>Sources ChrC)tiennes</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
>



--
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.