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]

Format of Biblionentries


Hi list, some days ago, I asked around if someone had an adaption for a
fixed rule for biblioentries. This didn't seem to be of much interest,
but nevertheless, here is my solution.
It is not as flexible as the default, but, if properly applied, the
result is always the same, no matter how the source is formatted.

The style and an example PDF are appended, and here is some XML:



<bibliography>
<title>Quellenangaben</title>
	<bibliodiv>
	<title>Bücher</title>
	
	
	<biblioentry id="Niedermair2001">
		<abbrev>Niedermair2001</abbrev>
		<authorgroup>
	
<author><firstname>Elke</firstname><surname>Niedermair</surname></author
>
	
<author><firstname>Michael</firstname><surname>Niedermair</surname></aut
hor>
		</authorgroup>
		<title>Das große Buch - XML</title>
		<pubdate>2001</pubdate>
		<publisher><publishername>Data Becker GmbH &amp; Co. KG,
Düsseldorf, BRD</publishername></publisher>
		<isbn>3-8158-2122-3</isbn>
      <abstract><para>Das Buch verwendet DocBook teilweise für
Beispiele.
       kdafh sladkhf asdlkfhdsa kfhasdlkfh sdaf
       f adskfhs adkfhdalfh sadlkhf asklfsd
       f sdakfhsdklf hsdklfhsdaf lhasdkljf hsdakfjhasd lkj
      
      </para></abstract>
	</biblioentry>

	<biblioentry id="Deitel2000">
		<abbrev>Deitel2000</abbrev>
		<authorgroup>
	
<author><firstname>Harvey</firstname><surname>Deitel</surname></author>
	
<author><firstname>Paul</firstname><surname>Deitel</surname></author>
			<author><othername>et al</othername></author>
		</authorgroup>
		<title>XML - How to program</title>
		<pubdate>2000</pubdate>
		<publisher><publishername>Prentice-Hall, Inc., London,
GB</publishername></publisher>
		<isbn>0-13-028417-3</isbn>
	</biblioentry>

	
	<biblioentry id="Walsh1999">
		<abbrev>Walsh1999</abbrev>
		<authorgroup>
	
<author><firstname>Norman</firstname><surname>Walsh</surname></author>
	
<author><firstname>Leonard</firstname><surname>Muellner</surname></autho
r>
		</authorgroup>
		<title>DocBook - The Definitive Guide</title>
		<pubdate>1999</pubdate>
		<publisher><publishername>O'Reilly and Associates, Inc.,
Sebastopol, USA</publishername></publisher>
		<isbn>1-56592-580-7</isbn>
	</biblioentry>
	
	
	</bibliodiv>

   
   
   
 
<bibliodiv>
<title>Weblinks</title>


 <biblioentry id="bib_sw">
  <abbrev>SW</abbrev>
  <biblioset relation='internet'>    
    <title>My Own Home Page</title>
    <bibliosource id="link_SW"> 
       <ulink url="http://www.stephanwiesner.de/java";>
       http://www.stephanwiesner.de/java</ulink>
    </bibliosource>
    <abstract><para>My own, humble, homepage.
    </para></abstract>
  </biblioset>
 </biblioentry>


 <biblioentry>
  <biblioset relation='internet'>
    <title>The Java API for Xml Processing (JAXP) Tutorial</title>
    <bibliosource id="linkSunXML">
       <ulink
url="http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/index.html";>
       http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/index.html 
       (Visited 11.1.2001)</ulink></bibliosource>    
    </biblioset>
    <abbrev>BibSunXML</abbrev>
 </biblioentry>

</bibliodiv>







<bibliodiv><title>Periodicals</title>

<biblioentry>
  <abbrev>Strohmaier</abbrev>
  <biblioset relation='journal'>
    <title>Informatik Spektrum</title>
    <edition>25</edition>
    <date>August 2002</date>
    <publisher>
      <publishername>Springer-Verlag</publishername>
      <address>
        <country>Germany</country>
      </address>
    </publisher>
    <issn>0170-6012</issn>
  </biblioset>
  <biblioset relation='article'>
    <title>XML-Strukturakquisition</title>
    <abstract><para></para></abstract>
 
<author><surname>Strohmaier</surname><firstname>Christian</firstname></a
uthor>
    <pagenums>262-265</pagenums>
  </biblioset>
</biblioentry>



<biblioentry>
  <abbrev>Esswein</abbrev>
  <biblioset relation='journal'>
    <title>Informatik Spektrum</title>
    <edition>25</edition>
    <date>August 2002</date>
    <publisher>
      <publishername>Springer-Verlag</publishername>
      <address>
        <country>Germany</country>
      </address>
    </publisher>
    <issn>0170-6012</issn>
  </biblioset>
  <biblioset relation='article'>
    <title>Realisierung eines Datenaustausches im elektronischen
Handel</title>
    <abstract><para>Der elektronische Handel befindet
    sich in der ersten Hälfte seiner Entwicklung und ist doch schon
Normalität 
    in den Unternemen. Für die Realisierung des Datenaustauschs
benötigen die 
    Unternhemen Kommunikationsstandards und
Softwarelösungen.</para></abstract>
 
<author><surname>Esswein</surname><firstname>Werner</firstname></author>
 
<author><surname>Zumpe</surname><firstname>Sabine</firstname></author>
    <pagenums>251-261</pagenums>
  </biblioset>
</biblioentry>

</bibliodiv>   
   
</bibliography>


Stephan

<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0"
                xmlns:fo="http://www.w3.org/1999/XSL/Format";
                exclude-result-prefixes="#default"
>



<xsl:variable name="biblio.text.size">8pt</xsl:variable>
<xsl:variable name="bibliodiv.title.size">14pt</xsl:variable>




   
<xsl:template name="biblioentry.label">
  <xsl:param name="node" select="."/>
  <xsl:choose>
    <xsl:when test="$node/abbrev">
      <xsl:text>[</xsl:text>
      <xsl:apply-templates select="$node/abbrev[1]"/>
      <xsl:text>] </xsl:text>
    </xsl:when>
    <xsl:when test="$bibliography.numbered != 0">
      <xsl:text>[</xsl:text>
      <xsl:number from="bibliography" count="biblioentry|bibliomixed" format="1"/>
      <xsl:text>] </xsl:text>
    </xsl:when>
    <xsl:when test="$node/@id">
      <xsl:text>[</xsl:text>
      <xsl:value-of select="$node/@id"/>
      <xsl:text>] </xsl:text>
    </xsl:when>
    <xsl:otherwise><!-- nop --></xsl:otherwise>
  </xsl:choose>
</xsl:template>



<xsl:template match="abstract" mode="bibliography.mode">
  <fo:inline>
    <xsl:apply-templates mode="bibliography.mode"/>
  </fo:inline>
</xsl:template>
   
   

<xsl:template match="edition" mode="bibliography.mode.periodical">
  <fo:inline>&#160;
    <xsl:apply-templates mode="bibliography.mode"/>
    <!--xsl:value-of select="$biblioentry.item.separator"/-->
  </fo:inline>
</xsl:template>


<xsl:template match="edition" mode="bibliography.mode.book">
  <fo:inline>
    <xsl:apply-templates mode="bibliography.mode"/>
    <xsl:value-of select="$biblioentry.item.separator"/>
  </fo:inline>
</xsl:template>




<xsl:template match="authorgroup" mode="bibliography.mode">  
  <fo:inline>
    <xsl:value-of select="author[position()=1]/surname" />
    <xsl:if test="author[position()=1]/firstname">,&#160;
      <xsl:value-of select="author[position()=1]/firstname" />
    </xsl:if>
    <xsl:value-of select="$biblioentry.item.separator"/>
    
    <xsl:for-each select="author[(position()!=1)and(surname|firstname)]">
      <xsl:sort select="surname | firstname" />
      <xsl:choose>
        <xsl:when test="othername">
          <xsl:value-of select="othername"/>          
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="firstname"/>&#160;<xsl:value-of select="surname"/>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:value-of select="$biblioentry.item.separator"/>
    </xsl:for-each>
    <xsl:for-each select="author[(position()!=1)and(othername!='')]">
      <xsl:value-of select="othername"/>
      <xsl:value-of select="$biblioentry.item.separator"/>
    </xsl:for-each>
  </fo:inline>
</xsl:template>



<xsl:template match="pubdate" mode="bibliography.mode">
  <fo:inline>
    <xsl:apply-templates mode="bibliography.mode"/>.
  </fo:inline>
</xsl:template>



<xsl:template match="address" mode="bibliography.mode">
  <fo:inline hyphenate="false"
  >
    <xsl:apply-templates mode="bibliography.mode"/>
    <xsl:value-of select="$biblioentry.item.separator"/>
  </fo:inline>
</xsl:template>


<xsl:template match="pagenums" mode="bibliography.mode">
  <fo:inline>
    : <xsl:apply-templates mode="bibliography.mode"/>
  </fo:inline>
</xsl:template>


<xsl:template match="biblioset[@relation='journal']/title" mode="bibliography.mode">
  <fo:inline>
    <fo:inline font-style="italic">
      <xsl:apply-templates mode="bibliography.mode"/>
    </fo:inline>
    
  </fo:inline>
</xsl:template>


<xsl:template match="biblioset[@relation='article']/title" mode="bibliography.mode">
  <fo:inline>
    <xsl:apply-templates mode="bibliography.mode"/>
    <xsl:value-of select="$biblioentry.item.separator"/>
  </fo:inline>
</xsl:template>




<xsl:template match="bibliodiv">
  <fo:block
  hyphenate="false">
  <xsl:apply-templates select="title"/>
    <xsl:apply-templates select="biblioentry">
      <xsl:sort select="abbrev" />
    </xsl:apply-templates>
    
  </fo:block>
</xsl:template>


<xsl:template match="bibliodiv/title">
  <xsl:variable name="id">
    <xsl:call-template name="object.id">
      <xsl:with-param name="object" select=".."/>
    </xsl:call-template>
  </xsl:variable>
  <fo:block font-size="{$bibliodiv.title.size}" font-weight="bold"
            font-family="{$title.font.family}"
            keep-with-next.within-column="always"
            space-before="0.5cm"
            >
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>



<xsl:template match="biblioentry">
  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
  <xsl:choose>
    <xsl:when test="string(.) = ''">
      <xsl:variable name="bib" select="document($bibliography.collection)"/>
      <xsl:variable name="entry" select="$bib/bibliography/*[@id=$id][1]"/>
      <xsl:choose>
        <xsl:when test="$entry">
          <xsl:apply-templates select="$entry"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:message>
            <xsl:text>No bibliography entry: </xsl:text>
            <xsl:value-of select="$id"/>
            <xsl:text> found in </xsl:text>
            <xsl:value-of select="$bibliography.collection"/>
          </xsl:message>
          <fo:block id="{$id}" xsl:use-attribute-sets="normal.para.spacing">
            <xsl:text>Error: no bibliography entry: </xsl:text>
            <xsl:value-of select="$id"/>
            <xsl:text> found in </xsl:text>
            <xsl:value-of select="$bibliography.collection"/>
          </fo:block>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <fo:block id="{$id}" xsl:use-attribute-sets="normal.para.spacing"
                start-indent="0.5in" text-indent="-0.5in">
        <xsl:call-template name="biblioentry.label"/>
        
        <xsl:choose>
          <xsl:when test="biblioset[@relation='article']">
             <fo:inline>
             <xsl:if test="biblioset/author">  
             <xsl:value-of select="biblioset/author[position()=1]/surname" />
             <xsl:if test="biblioset/author[position()=1]/firstname">,&#160;
               <xsl:value-of select="biblioset/author[position()=1]/firstname" />
             </xsl:if>
             <xsl:value-of select="$biblioentry.item.separator"/>
             
             <xsl:for-each select="biblioset/author[position()!=1]">
               <xsl:sort select="surname | firstname" />
               <xsl:value-of select="firstname"/>&#160;<xsl:value-of select="surname"/>
               <xsl:value-of select="$biblioentry.item.separator"/>
             </xsl:for-each>
             </xsl:if>
             </fo:inline>
             <xsl:apply-templates select="biblioset/authorgroup" mode="bibliography.mode"/>
             <xsl:apply-templates select="biblioset[@relation='article']/title" mode="bibliography.mode"/>             
             <xsl:apply-templates select="biblioset[@relation='journal']/title" mode="bibliography.mode"/>
             <xsl:apply-templates select="biblioset/edition" mode="bibliography.mode.periodical"/>            
             <xsl:apply-templates select="biblioset/pubdate" mode="bibliography.mode"/>
             <xsl:apply-templates select="biblioset/pagenums" mode="bibliography.mode"/>
             <xsl:if test="biblioset/issn">
              ISSN <xsl:apply-templates select="biblioset/issn" mode="bibliography.mode"/>
             </xsl:if>            
            <xsl:apply-templates select="biblioset/abstract" mode="bibliography.mode"/>
          </xsl:when>







          <xsl:when test="biblioset[@relation='internet']">
             <fo:inline>
             <xsl:if test="biblioset/author">  
             <xsl:value-of select="biblioset/author[position()=1]/surname" />
             <xsl:if test="biblioset/author[position()=1]/firstname">,&#160;
               <xsl:value-of select="biblioset/author[position()=1]/firstname" />
             </xsl:if>
             <xsl:value-of select="$biblioentry.item.separator"/>
             
             <xsl:for-each select="biblioset/author[position()!=1]">
               <xsl:sort select="surname | firstname" />
               <xsl:value-of select="firstname"/>&#160;<xsl:value-of select="surname"/>
               <xsl:value-of select="$biblioentry.item.separator"/>
             </xsl:for-each>
             </xsl:if>
             </fo:inline>
             <xsl:apply-templates select="biblioset/authorgroup" mode="bibliography.mode"/>
             <xsl:value-of select="biblioset/title"/>.
             <xsl:value-of select="biblioset/bibliosource/ulink"/>.
             <xsl:apply-templates select="biblioset/abstract" mode="bibliography.mode"/>
          </xsl:when>



          


          <xsl:otherwise> <!-- books   -->
           <fo:inline>  
             <xsl:if test="author">    
             <xsl:value-of select="author[position()=1]/surname" />
             <xsl:if test="author[position()=1]/firstname">,&#160;
               <xsl:value-of select="author[position()=1]/firstname" />
             </xsl:if>
             <xsl:value-of select="$biblioentry.item.separator"/>
             
             <xsl:for-each select="author[position()!=1]">
               <xsl:sort select="surname | firstname" />
               <xsl:value-of select="firstname"/>&#160;<xsl:value-of select="surname"/>
               <xsl:value-of select="$biblioentry.item.separator"/>
             </xsl:for-each>
             </xsl:if>
           </fo:inline>

            <xsl:apply-templates select="authorgroup" mode="bibliography.mode"/>
            <xsl:apply-templates select="title" mode="bibliography.mode"/>
            <xsl:apply-templates select="edition" mode="bibliography.mode.book"/>
            <xsl:apply-templates select="publisher" mode="bibliography.mode"/>
            <xsl:apply-templates select="pubdate" mode="bibliography.mode"/>
            <xsl:apply-templates select="pages" mode="bibliography.mode"/>
            <xsl:if test="isbn">
             ISBN <xsl:apply-templates select="isbn" mode="bibliography.mode"/>
            </xsl:if>
            <xsl:apply-templates select="abstract" mode="bibliography.mode"/>
          </xsl:otherwise>
        </xsl:choose>
        
      </fo:block>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
 

 
 
 
 
 <!--
  Blocksatz
  Schriftgrösse
  
  $id für die Links vom Inhaltsverzeichnis.
 -->
 
 <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::book">
      <xsl:variable name="master-reference">
        <xsl:call-template name="select.pagemaster"/>
      </xsl:variable>

      <fo:page-sequence id="{$id}"
                        hyphenate="{$hyphenate}"
                        master-reference="{$master-reference}"
                        text-align="left"
                        font-size="{$biblio.text.size}"
      >
                         
        <xsl:attribute name="language">
          <xsl:call-template name="l10n.language"/>
        </xsl:attribute>
        <xsl:attribute name="format">
          <xsl:call-template name="page.number.format"/>
        </xsl:attribute>
        <xsl:if test="$double.sided != 0">
          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
        </xsl:if>

        <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="component.separator"/>
        <xsl:call-template name="bibliography.titlepage"/>
        <xsl:apply-templates/>
      </fo:block>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
 
</xsl:stylesheet>

Attachment: Olly.pdf
Description: Adobe PDF document


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