<xsl:template match="ptr[@type = 'biblref']" priority="10">
<xsl:variable name="bibl" select="id(substring-after(@target,'#'))"/>
<span>
<xsl:call-template name="id"/>
<xsl:call-template name="rendition">
<xsl:with-param name="defaultRend" select="'biblref'"/>
</xsl:call-template>
<xsl:call-template name="rend"/>
<xsl:value-of select="'['"/>
<a href="{@target}">
<xsl:choose>
<xsl:when test="$bibl/author">
<xsl:choose>
<xsl:when test="$bibl/author/persName/surname">
<xsl:value-of select="concat(normalize-space($bibl/author[1]/persName/surname),'. ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(normalize-space($bibl/author[1]),'. ')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$bibl/editor">
<xsl:choose>
<xsl:when test="$bibl/editor/persName/surname">
<xsl:value-of select="concat(normalize-space($bibl/editor[1]/persName/surname),'. ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(normalize-space($bibl/editor[1]),'. ')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$bibl/name[@type = 'product']">
<xsl:variable name="product">
<xsl:apply-templates select="$bibl/name[@type = 'product']"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="ends-with(normalize-space($product), '.') or ends-with(normalize-space($product), '.’') or ends-with(normalize-space($product), '.”')">
<xsl:value-of select="concat(normalize-space($product), ' ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(normalize-space($product), '. ')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$bibl/title[@level = 'a']">
<xsl:variable name="title">
<xsl:apply-templates select="$bibl/title[@level = 'a'][1]"/>
</xsl:variable>
<!-- check whether or not to add period. -->
<xsl:choose>
<xsl:when test="ends-with(normalize-space($title), '.') or ends-with(normalize-space($title), '.’') or ends-with(normalize-space($title), '.”')">
<xsl:value-of select="concat(normalize-space($title), ' ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(normalize-space($title), '. ')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$bibl/title">
<xsl:variable name="title">
<xsl:apply-templates select="$bibl/title[1]"/>
</xsl:variable>
<!-- check whether or not to add period. -->
<xsl:choose>
<xsl:when test="ends-with(normalize-space($title), '.') or ends-with(normalize-space($title), '.’') or ends-with(normalize-space($title), '.”')">
<xsl:copy-of select="$title"/>
<xsl:value-of select="' '"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$title"/>
<xsl:value-of select="'. '"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:message>WARNING: No author/editor in bibl</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$bibl/note[@type = 'ms'] and $bibl/date[@type = 'creation']">
<xsl:value-of select="$bibl/date[@type = 'creation']"/>
</xsl:when>
<xsl:when test="$bibl/date[@type = 'publication']">
<xsl:value-of select="$bibl/date[@type = 'publication']"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$bibl/date"/>
</xsl:otherwise>
</xsl:choose>
</a>
<xsl:value-of select="']'"/>
</span>
</xsl:template> |