<?xml version="1.0" encoding="UTF-8"?><!-- $Header: /usr/cvs/Sharef/Sharef/bibconvert/xslt/common_import.xsl,v 1.14 2005/11/09 14:06:17 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">	<xsl:template name="process_date">		<xsl:param name="year" select="''"/>		<xsl:param name="month" select="''"/>		<xsl:param name="day" select="''"/>		<xsl:param name="text" select="''"/>		<date>			<xsl:variable name="date">				<xsl:choose>					<xsl:when test="(($year castable as xs:gYear) and (string-length($year) &lt; 5)) and (concat('--',$month,'--') castable as xs:gMonth) and (concat('---',$day) castable as xs:gDay)">						<xsl:value-of select="concat($year,'-',$month,'-',$day)"/>					</xsl:when>					<xsl:when test="($year castable as xs:gYear) and (concat('--',$month,'--') castable as xs:gMonth)">						<xsl:value-of select="concat($year,'-',$month)"/>					</xsl:when>					<xsl:when test="($year castable as xs:gYear)">						<xsl:value-of select="$year"/>					</xsl:when>				</xsl:choose>			</xsl:variable>			<xsl:if test="string-length($date) > 0">				<xsl:attribute name="value" select="$date"/>			</xsl:if>			<!-- if something was not castable or the text was different from the date values, the text is copied as <date> content -->			<xsl:if test="((string-length($year) > 0 and not($year castable as xs:gYear)) or (string-length($month) > 0 and not(concat('--',$month) castable as xs:gMonth)) or (string-length($day) > 0 and not (concat('---',$day) castable as xs:gDay))) or ($text ne concat($year,'-',$month,'-',$day))">				<xsl:value-of select="$text"/>			</xsl:if>		</date>	</xsl:template>	<xsl:template name="create_mime_uri">		<xsl:variable name="uri" select="normalize-space(.)"/>		<identifier type="sharef:uri">			<xsl:variable name="resourceType">				<xsl:choose>					<xsl:when test="ends-with($uri,'.htm') or ends-with($uri,'.HTM') or ends-with($uri,'.html') or ends-with($uri,'.HTML')">text/html</xsl:when>					<xsl:when test="ends-with($uri,'.pdf') or ends-with($uri,'.PDF')">application/pdf</xsl:when>					<xsl:when test="ends-with($uri,'.ps') or ends-with($uri,'.PS')">application/postscript</xsl:when>					<xsl:when test="ends-with($uri,'.doc') or ends-with($uri,'.DOC')">application/msword</xsl:when>					<xsl:when test="ends-with($uri,'.txt') or ends-with($uri,'.TXT')">text/plain</xsl:when>				</xsl:choose>			</xsl:variable>			<xsl:if test="string-length($resourceType) gt 0">				<xsl:attribute name="resourceType" select="$resourceType"/>			</xsl:if>			<xsl:value-of select="$uri"/>		</identifier>	</xsl:template></xsl:stylesheet>
