<?xml version="1.0" encoding="UTF-8"?><!-- $Header: /usr/cvs/Sharef/Sharef/bibconvert/xslt/common_export.xsl,v 1.5 2005/11/22 10:41:46 dret Exp $ --><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://dret.net/xmlns/sharef" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sharef="http://dret.net/xmlns/sharef" exclude-result-prefixes="#default sharef xs" xpath-default-namespace="http://dret.net/xmlns/sharef">	<xsl:function name="sharef:refkey">		<xsl:param name="ref"/>		<xsl:param name="key"/>		<xsl:choose>			<xsl:when test="($key eq 'date') or ($key eq 'date-desc')">				<xsl:choose>					<xsl:when test="$ref/date/@value">						<xsl:value-of select="$ref/date/@value"/>					</xsl:when>					<xsl:when test="$ref/date">						<!-- there is a date, but not a typed @value for it -->						<xsl:value-of select="$ref/date/text()"/>					</xsl:when>				</xsl:choose>			</xsl:when>			<xsl:when test="$key eq 'name'">				<xsl:choose>					<xsl:when test="$ref/names[@type = 'sharef:author']">						<xsl:value-of select="sharef:sortname($ref/names[@type = 'sharef:author'])"/>					</xsl:when>					<xsl:when test="$ref/names[@type = 'sharef:editor']">						<xsl:value-of select="sharef:sortname($ref/names[@type = 'sharef:editor'])"/>					</xsl:when>					<xsl:otherwise>						<!-- if there is no primary or secondary name, take any name (a rather random strategy...) -->						<xsl:value-of select="sharef:sortname($ref/names[1])"/>					</xsl:otherwise>				</xsl:choose>			</xsl:when>			<xsl:when test="$key eq 'title'">				<xsl:choose>					<xsl:when test="$ref/title[@type = 'sharef:primaryTitle']">						<xsl:value-of select="$ref/title[@type = 'sharef:primaryTitle']"/>					</xsl:when>					<xsl:when test="$ref/title[@type = 'sharef:secondaryTitle']">						<xsl:value-of select="$ref/title[@type = 'sharef:secondaryTitle']"/>					</xsl:when>					<xsl:otherwise>						<!-- if there is no primary or secondary title, take any title (a rather random strategy...) -->						<xsl:value-of select="$ref/title"/>					</xsl:otherwise>				</xsl:choose>			</xsl:when>			<xsl:when test="$key = 'refname'">				<xsl:value-of select="$ref/@name"/>			</xsl:when>		</xsl:choose>	</xsl:function>	<xsl:function name="sharef:sortname">		<xsl:param name="names"/>		<xsl:choose>			<xsl:when test="local-name($names/*[1]) = 'person'">				<xsl:value-of select="concat($names/person[1]/surname, $names/person[1]/givenname)"/>			</xsl:when>			<xsl:otherwise>				<xsl:value-of select="$names/name[1]"/>			</xsl:otherwise>		</xsl:choose>	</xsl:function>	<xsl:function name="sharef:generate-ref-name">		<xsl:param name="author"/>		<xsl:param name="year"/>		<xsl:value-of select="concat(if (string-length(replace(lower-case($author), '[^a-zA-Z0-9]', '')) gt 0) then substring(replace(lower-case($author), '[^a-zA-Z0-9]', ''), 1, 6) else 'anonym', if (string-length($year) ge 4) then substring($year, 3, 2) else '??')"/>	</xsl:function></xsl:stylesheet>
