This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Re: sorting bibliography by authors


Hi,
The problem was that your document uses bibliodiv's, and the posted
customization was sorting biblioentry elements that were directly inside a
bibliography element.  So you just need to copy the bibliodiv template from
fo/biblio.xsl to your customization layer and change the xsl:apply-templates
to:

   <xsl:apply-templates>
      <xsl:sort select=".//surname"/>
    </xsl:apply-templates>


Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Deepak K. Shrestha" <d888pak@netscape.net>
To: <docbook-apps@lists.oasis-open.org>
Sent: Thursday, November 18, 2004 10:19 PM
Subject: Re: [docbook-apps] Re: sorting bibliography by authors


> I have tried this FO in my template but doen't seem to do anything. The
> PDF result is still the same ( no change). By the way my bibliography
> specific customization is as follows:
>
> --------------
> <!-- ****************** BIBLIOGRAPHY CUSTOMIZATION ********************
> //-->
>
> <!-- Left align the bibliography so that short entries will not try to
> fit in whole line //-->
> <xsl:template match="biblioentry[ancestor::bibliography]">
>          <fo:block text-align="left">
>                  <xsl:apply-imports/>
>          </fo:block>
> </xsl:template>
>
>
>
> <!--  Order the Authors/Editors Name in Surname, Firstname order //-->
> <xsl:template match="author|editor" mode="bibliography.mode">
>     <fo:inline>
>         <xsl:call-template name="person.name.last-first"/>
>         <xsl:value-of select="$biblioentry.item.separator"/>
>     </fo:inline>
> </xsl:template>
>
>
> <!-- For ordering the authors in Surname,Firstname which are in
> authorgroup other than single author //-->
> <xsl:template name="person.name.list">
>    <!-- Return a formatted string representation of the contents of
>         the current element. The current element must contain one or
>         more AUTHORs, CORPAUTHORs, OTHERCREDITs, and/or EDITORs.
>
>         John Doe
>       or
>         John Doe and Jane Doe
>       or
>         John Doe, Jane Doe, and A. Nonymous
>    -->
>    <xsl:param name="person.list"
>               select="author|corpauthor|othercredit|editor"/>
>    <xsl:param name="person.count" select="count($person.list)"/>
>    <xsl:param name="count" select="1"/>
>
>    <xsl:choose>
>      <xsl:when test="$count &gt; $person.count"></xsl:when>
>      <xsl:otherwise>
>        <xsl:call-template name="person.name.last-first">
>          <xsl:with-param name="node"
> select="$person.list[position()=$count]"/>
>        </xsl:call-template>
>
>        <xsl:choose>
>          <xsl:when test="$person.count = 2 and $count = 1">
>            <xsl:call-template name="gentext.template">
>              <xsl:with-param name="context" select="'authorgroup'"/>
>              <xsl:with-param name="name" select="'sep2'"/>
>            </xsl:call-template>
>          </xsl:when>
>          <xsl:when test="$person.count &gt; 2 and $count+1 =
$person.count">
>            <xsl:call-template name="gentext.template">
>              <xsl:with-param name="context" select="'authorgroup'"/>
>              <xsl:with-param name="name" select="'seplast'"/>
>            </xsl:call-template>
>          </xsl:when>
>          <xsl:when test="$count &lt; $person.count">
>            <xsl:call-template name="gentext.template">
>              <xsl:with-param name="context" select="'authorgroup'"/>
>              <xsl:with-param name="name" select="'sep'"/>
>            </xsl:call-template>
>          </xsl:when>
>        </xsl:choose>
>
>        <xsl:call-template name="person.name.list">
>          <xsl:with-param name="person.list" select="$person.list"/>
>          <xsl:with-param name="person.count" select="$person.count"/>
>          <xsl:with-param name="count" select="$count+1"/>
>        </xsl:call-template>
>      </xsl:otherwise>
>    </xsl:choose>
> </xsl:template><!-- person.name.list -->
>
>
> <!--  Turn off the bibliography label eg. [deepak et. al. 2002] from
> displaying in front of bibliogaphy entries by customizing the template
> to do nothing //-->
> <xsl:template name="biblioentry.label">
> </xsl:template>
>
> ----------------------------
>
> In this case, what other additional customization do I need for sorting
> the each entry by authors surname and date?
>
> Thanks for the help
>
> Deepak K. Shrestha
>
>
> Yoshihiro Toda wrote:
> > Hi, Deepak.  Try these templates.
> >
>
>
> > For FO:
> >
> > <xsl:template match="bibliography">
> >   <xsl:variable name="id">
> >     <xsl:call-template name="object.id"/>
> >   </xsl:variable>
> >
> >   <xsl:choose>
> >     <xsl:when test="not(parent::*) or parent::part or parent::book">
> >       <xsl:variable name="master-reference">
> >         <xsl:call-template name="select.pagemaster"/>
> >       </xsl:variable>
> >
> >       <fo:page-sequence hyphenate="{$hyphenate}"
> >                         master-reference="{$master-reference}">
> >         <xsl:attribute name="language">
> >           <xsl:call-template name="l10n.language"/>
> >         </xsl:attribute>
> >         <xsl:attribute name="format">
> >           <xsl:call-template name="page.number.format">
> >             <xsl:with-param name="master-reference"
select="$master-reference"/>
> >           </xsl:call-template>
> >         </xsl:attribute>
> >         <xsl:attribute name="initial-page-number">
> >           <xsl:call-template name="initial.page.number">
> >             <xsl:with-param name="master-reference"
select="$master-reference"/>
> >           </xsl:call-template>
> >         </xsl:attribute>
> >         <xsl:attribute name="force-page-count">
> >           <xsl:call-template name="force.page.count">
> >             <xsl:with-param name="master-reference"
select="$master-reference"/>
> >           </xsl:call-template>
> >         </xsl:attribute>
> >         <xsl:attribute name="hyphenation-character">
> >           <xsl:call-template name="gentext">
> >             <xsl:with-param name="key"
select="'hyphenation-character'"/>
> >           </xsl:call-template>
> >         </xsl:attribute>
> >         <xsl:attribute name="hyphenation-push-character-count">
> >           <xsl:call-template name="gentext">
> >             <xsl:with-param name="key"
select="'hyphenation-push-character-count'"/>
> >           </xsl:call-template>
> >         </xsl:attribute>
> >         <xsl:attribute name="hyphenation-remain-character-count">
> >           <xsl:call-template name="gentext">
> >             <xsl:with-param name="key"
select="'hyphenation-remain-character-count'"/>
> >           </xsl:call-template>
> >         </xsl:attribute>
> >
> >         <xsl:apply-templates select="." mode="running.head.mode">
> >           <xsl:with-param name="master-reference"
select="$master-reference"/>
> >         </xsl:apply-templates>
> >         <xsl:apply-templates select="." mode="running.foot.mode">
> >           <xsl:with-param name="master-reference"
select="$master-reference"/>
> >         </xsl:apply-templates>
> >
> >         <fo:flow flow-name="xsl-region-body">
> >           <fo:block id="{$id}">
> >             <xsl:call-template name="bibliography.titlepage"/>
> >           </fo:block>
> >           <xsl:apply-templates/>
> >         </fo:flow>
> >       </fo:page-sequence>
> >     </xsl:when>
> >     <xsl:otherwise>
> >       <fo:block id="{$id}"
> >                 space-before.minimum="1em"
> >                 space-before.optimum="1.5em"
> >                 space-before.maximum="2em">
> >         <xsl:call-template name="bibliography.titlepage"/>
> >       </fo:block>
> >       <xsl:apply-templates>
> >         <xsl:sort select=".//surname"/>
> >       </xsl:apply-templates>
> >     </xsl:otherwise>
> >   </xsl:choose>
> > </xsl:template>
> >
> > # BTW, is there any way to define `advice' (in elisp sense) in XSLT?
>
>



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]