Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15
<xsl:stylesheet xmlns:bib="http://purl.org/NET/xbiblio/citeproc" xmlns="http://purl.org/NET/xbiblio/citeproc" xmlns:cs="http://purl.org/NET/xbiblio/csl" xmlns:db="http://docbook.org/ns/docbook" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdoc="http://www.pnp-software.com/XSLTdoc" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" exclude-result-prefixes="xhtml mods xdoc db bib xs cs">
��
<xsl:preserve-space elements="cs:prefix cs:suffix" />
��
<!--�===�licensed�under�CC-GNU�GPL;�see�http://creativecommons.org/licenses/GPL/2.0�===�-->
��
��<xdoc:doc type="stylesheet">
����
<xdoc:short>Process�CSL�files�to�configure�formatting.</xdoc:short>
����
<xdoc:author>Bruce�D’Arcus</xdoc:author>
����
<xdoc:copyright>2004,�Bruce�D’Arcus</xdoc:copyright>
��
</xdoc:doc>

��
<xsl:variable name="refclass-partInSerial" select="('article-newspaper','legal case','bill','article','conference paper')" />
��
<xsl:variable name="refclass-partInMonograph" select="('song','chapter')" />
��
<xsl:variable name="refclass-monograph" select="('report','personal communication','book')" />
��
<xsl:variable name="genres" select="('thesis', 'newsletter', 'dissertation')" />
��
��
<xsl:template match="cs:citation">
����
<xsl:param name="cite-ref" as="node()" tunnel="yes" />
����
<xsl:param name="last-in-author-group" as="xs:boolean?" tunnel="yes" />
����
<xsl:param name="bib:source" as="element(mods:mods)?" tunnel="yes" />
����
<bib:a class="citation" href="#{@ID}">
������
<xsl:choose>
��������
<xsl:when test="cs:first">
����������
<xsl:choose>
������������
<xsl:when test="bib:first-reference($cite-ref)">
��������������
<xsl:apply-templates select="cs:first">
����������������
<xsl:with-param name="use_reftype" select="$bib:source/@bib:use-reftype" tunnel="yes" />
��������������
</xsl:apply-templates>������
������������
</xsl:when>
������������
<xsl:otherwise>
��������������
<xsl:apply-templates select="cs:subsequent">
����������������
<xsl:with-param name="use_reftype" select="$bib:source/@bib:use-reftype" tunnel="yes" />
��������������
</xsl:apply-templates>
������������
</xsl:otherwise>
����������
</xsl:choose>
��������
</xsl:when>
��������
<xsl:otherwise>
����������
<xsl:apply-templates select="* except (cs:prefix|cs:suffix)">
������������
<xsl:with-param name="use_reftype" select="$bib:source/@bib:use-reftype" tunnel="yes" />
����������
</xsl:apply-templates>��������
��������
</xsl:otherwise>
������
</xsl:choose>
����
</bib:a>
����
<xsl:if test="not($last-in-author-group) and not($citeclass='number' or $citeclass='citekey')">,�</xsl:if>
��
</xsl:template>
��
��
<!--�FIX�ME:�move�below�code�to�CSL�templates�
������<xsl:value-of�select="bib:year-suffix"/>
��
-->
��
<xsl:template match="cs:point">
����
<xsl:param name="cite-ref" as="node()" tunnel="yes" />
����
<xsl:if test="$cite-ref/@begin">
������
<xsl:apply-templates select="cs:prefix" />
������
<xsl:value-of select="$cite-ref/@begin" />
������
<xsl:if test="$cite-ref/@end">
��������
<xsl:text></xsl:text>
��������
<xsl:value-of select="bib:number-condense($cite-ref/@begin, $cite-ref/@end)" />
������
</xsl:if>
����
</xsl:if>����
��
</xsl:template>

��
<xsl:template match="cs:first">
����
<xsl:apply-templates select="cs:layout">
������
<xsl:with-param name="multi-authors" select="cs:multiple-authors" as="element(cs:multiple-authors)?" tunnel="yes" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:layout">
����
<xsl:param name="use_reftype" tunnel="yes" />
����
<xsl:apply-templates select="if (cs:reftype) then (cs:reftype[@name=$use_reftype]) else *" />
��
</xsl:template>

��
<xsl:template match="cs:subsequent">
����
<xsl:apply-templates select="if (cs:layout) then (cs:layout) else (preceding-sibling::cs:first/cs:layout)">
������
<xsl:with-param name="multi-authors" select="if (cs:multiple-authors) then (cs:multiple-authors) else (preceding-sibling::cs:first/cs:multiple-authors)" as="element(cs:multiple-authors)?" tunnel="yes" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:all">
����
<xsl:apply-templates select="cs:layout">
������
<xsl:with-param name="multi-authors" select="cs:multiple-authors" as="element(cs:multiple-authors)?" tunnel="yes" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:number">
����
<xsl:param name="cite-ref" as="node()" tunnel="yes" />
����
<span class="mark">
������
<xsl:value-of select="$bib:formatted-biblist/bib:item[@id=$cite-ref/@linkend]/@bib:biblist-number" />
����
</span>
��
</xsl:template>
��
��
<xsl:template match="cs:citekey">
����
<xsl:param name="cite-ref" as="node()" tunnel="yes" />
����
<span class="mark">
������
<xsl:value-of select="$cite-ref/@linkend" />
����
</span>
��
</xsl:template>
��
��
<!--�change�citeproc�to�apply-templates�here�with�use-reftype�parameter�-->
��
<xsl:template match="cs:bibliography">
����
<xsl:param name="bib:source" as="element(mods:mods)" tunnel="yes" />
����
<xsl:param name="use_reftype" as="xs:string" tunnel="yes" />
����
<xsl:apply-templates select="cs:layout/cs:reftype[@name=$use_reftype]">
������
<xsl:with-param name="multi-authors" select="cs:multiple-authors" as="element(cs:multiple-authors)?" tunnel="yes" />
������
<xsl:with-param name="em-dash-author" select="self::cs:bibliography and $bib:source/@bib:shorten-author='true'" as="xs:boolean?" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:reftype">
����
<!--�needed�to�change�the�below�to�optional;�may�need�to�check�this�again�later�-->
����
<xsl:param name="bib:number" as="xs:string?" tunnel="yes" />
����
<xsl:param name="bib:source" as="element(mods:mods)" tunnel="yes" />
����
<item class="bibref" id="{$bib:source/@ID}" bib:biblist-number="{$bib:number}">
������
<xsl:if test="$citeclass='number'">
��������
<span class="mark">
����������
<xsl:value-of select="$bib:number" />
��������
</span>
��������
<xsl:text>.�</xsl:text>
������
</xsl:if>
������
<xsl:if test="$citeclass='citekey'">
��������
<xsl:text>[</xsl:text>
��������
<xsl:value-of select="$bib:source/@ID" />
��������
<xsl:text>]�</xsl:text>
������
</xsl:if>
������
<xsl:apply-templates />
������
<xsl:value-of select="$bibref-after" />��
����
</item>
��
</xsl:template>
����
��
<xsl:template match="cs:creator">
����
<xsl:param name="first-in-author-group" as="xs:boolean?" tunnel="yes" />
����
<xsl:param name="local-cite-style" as="node()?" tunnel="yes" />
����
<xsl:choose>
������
<xsl:when test="ancestor::cs:citation">
��������
<xsl:if test="$first-in-author-group and not($local-cite-style='year')">
����������
<xsl:apply-templates select="cs:prefix" />
����������
<xsl:apply-templates select="cs:names | cs:names-short | cs:role" />
����������
<xsl:apply-templates select="cs:suffix" />
��������
</xsl:if>
������
</xsl:when>
������
<xsl:otherwise>
��������
<xsl:apply-templates select="cs:prefix" />
��������
<xsl:apply-templates select="cs:names | cs:names-short | cs:role" />
��������
<xsl:apply-templates select="cs:suffix" />
������
</xsl:otherwise>
����
</xsl:choose>
��
</xsl:template>
��
��
<xsl:template match="cs:creator/cs:names">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:param name="em-dash-author" as="xs:boolean?" tunnel="yes" />
����
<xsl:choose>
������
<xsl:when test="$em-dash-author">
��������
<!--�fix�to�config�in�CSL�-->
��������
<xsl:text>——�</xsl:text>
������
</xsl:when>
������
<xsl:otherwise>
��������
<xsl:apply-templates select="$bib:source/bib:noname-substitute" />
��������
<xsl:apply-templates select="$bib:source/mods:name[mods:role/mods:roleTerm=$primary-contributors]" mode="full">
����������
<xsl:with-param name="prefix" select="cs:prefix" />
����������
<xsl:with-param name="suffix" select="cs:suffix" />
����������
<xsl:with-param name="sort-order" select="$style-biblio/@author-as-sort-order" />
��������
</xsl:apply-templates>
������
</xsl:otherwise>
����
</xsl:choose>
��
</xsl:template>
��
��
<xsl:template match="cs:creator/cs:names-short">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:param name="em-dash-author" as="xs:boolean?" tunnel="yes" />
����
<xsl:choose>
������
<xsl:when test="$em-dash-author">
��������
<!--�fix�to�config�in�CSL�-->
��������
<xsl:text>——�</xsl:text>
������
</xsl:when>
������
<xsl:otherwise>
��������
<xsl:apply-templates select="$bib:source/bib:noname-substitute" />
��������
<xsl:apply-templates select="$bib:source/mods:name[mods:role/mods:roleTerm=$primary-contributors]" mode="short">
����������
<xsl:with-param name="prefix" select="cs:prefix" />
����������
<xsl:with-param name="suffix" select="cs:suffix" />
����������
<xsl:with-param name="sort-order" select="$style-biblio/@author-as-sort-order" />
��������
</xsl:apply-templates>
������
</xsl:otherwise>
����
</xsl:choose>
��
</xsl:template>
��
��
<xsl:template match="cs:role">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:name/mods:role">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:title">
����
<xsl:param name="bib:source" as="element()?" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:titleInfo[not(@type)]" mode="full">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
������
<xsl:with-param name="font-style" select="@font-style" />
������
<xsl:with-param name="font-weight" select="@font-weight" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:conference">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:name[@type='conference']/mods:namePart">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
������
<xsl:with-param name="font-style" select="@font-style" />
������
<xsl:with-param name="font-weight" select="@font-weight" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:origin">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:if test="$bib:source/mods:originInfo/mods:publisher or $bib:source/mods:originInfo/mods:place">
������
<span class="origin">
��������
<xsl:apply-templates />
������
</span>
����
</xsl:if>
��
</xsl:template>
��
��
<xsl:template match="cs:container">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<span class="container">
������
<xsl:apply-templates>
��������
<xsl:with-param name="bib:source" select="$bib:source/mods:relatedItem[@type='host']" as="element()" tunnel="yes" />
������
</xsl:apply-templates>
����
</span>
��
</xsl:template>
��
��
<xsl:template match="cs:series">
����
<xsl:param name="bib:source" as="element()?" tunnel="yes" />
����
<xsl:apply-templates>
������
<xsl:with-param name="bib:source" select="$bib:source/mods:relatedItem[@type='series']" as="element()?" tunnel="yes" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:part-details">
����
<xsl:apply-templates />
��
</xsl:template>
��
��
<xsl:template match="cs:prefix | cs:suffix">
����
<xsl:value-of select="." />
��
</xsl:template>
��
��
<xsl:template match="cs:issue">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:part/mods:detail[@type='issue']">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:file">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:part/mods:detail[@type='file']">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:volume">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:part/mods:detail[@type='volume']">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:genre">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:genre[text()=$genres]">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:medium">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:physicalDescription">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:pages">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:part/mods:extent[@unit='page']">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:place">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:originInfo/mods:place">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:publisher">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:originInfo/mods:publisher">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:date">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<!--�the�below�conditional�seems�a�bit�of�a�hack;�need�to�reconsider�later�-->
����
<xsl:variable name="date" select="(../$bib:source/mods:originInfo/mods:dateIssued, $bib:source/mods:originInfo/mods:dateIssued, $bib:source/mods:part/mods:date)[1]" />
����
<xsl:if test="cs:month and not($date castable as xs:gYear) or cs:year">
������
<span class="date">
��������
<xsl:apply-templates />
������
</span>
����
</xsl:if>
��
</xsl:template>
��
��
<xsl:template match="cs:year">
����
<!--�I'm�not�sure�why�requiring�the�bib:source�parameter�fails�in�some�cases�-->
����
<xsl:param name="bib:source" as="element()?" tunnel="yes" />
����
<xsl:param name="prefix" />
����
<xsl:param name="suffix" />
����
<xsl:apply-templates select="$bib:source/bib:year">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:month">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:param name="prefix" />
����
<xsl:param name="suffix" />
����
<!--�select�statement�is�a�problem;�problem�need�to�move�this�into�a�function�-->
����
<xsl:apply-templates select="$bib:source/mods:originInfo/mods:dateIssued|$bib:source/mods:part/mods:date" mode="month">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:day">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:param name="prefix" />
����
<xsl:param name="suffix" />
����
<xsl:apply-templates select="$bib:source/mods:originInfo/mods:dateIssued|$bib:source/mods:part/mods:date" mode="day">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
<!--�end�dates�-->
��
��
<xsl:template match="cs:availability">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:param name="prefix" />
����
<xsl:param name="suffix" />
����
<xsl:apply-templates select="$bib:source/mods:location">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>
��
��
<xsl:template match="cs:month-day">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:param name="prefix" />
����
<xsl:param name="suffix" />
����
<xsl:apply-templates select="$prefix" />
����
<span class="month-day">
������
<xsl:apply-templates select="$bib:source/mods:relatedItem/mods:part/mods:date|$bib:source/mods:relatedItem/mods:originInfo/mods:dateIssued" mode="date">
��������
<xsl:with-param name="prefix" select="cs:prefix" />
��������
<xsl:with-param name="suffix" select="cs:suffix" />
������
</xsl:apply-templates>
����
</span>
����
<xsl:apply-templates select="$suffix" />
��
</xsl:template>
��
��
<xsl:template match="cs:note">
����
<xsl:param name="bib:source" as="element()" tunnel="yes" />
����
<xsl:apply-templates select="$bib:source/mods:note[@type='citation']">
������
<xsl:with-param name="prefix" select="cs:prefix" />
������
<xsl:with-param name="suffix" select="cs:suffix" />
����
</xsl:apply-templates>
��
</xsl:template>

</xsl:stylesheet>






































v

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.