<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<!-- Transform of EndNote DTD to Digital Commons XML Schema  for versions of EndNote since X1 -->
	<xsl:template match="/">
		<documents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			xsi:noNamespaceSchemaLocation="http://www.bepress.com/document-import.xsd">

			<xsl:for-each select="xml/records/record">
				<document>
					<title>
						<xsl:value-of select="titles/title/style"/>
					</title>
					<publication-date>
						<xsl:variable name="datestr">
							<xsl:value-of select="dates/year/style"/>
						</xsl:variable>
						<xsl:value-of select="concat(substring($datestr, 1, 4),'-01-01')"/>
					</publication-date>
					<authors>
						<xsl:for-each select="contributors/authors/author">
							<author xsi:type="individual">
								<email> </email>
								<institution> </institution>
								<lname>
									<xsl:value-of select="substring-before(style,',')"/>
								</lname>
								<fname>
									<xsl:value-of select="substring-after(style,', ')"/>
								</fname>
							</author>
						</xsl:for-each>
					</authors>
					<keywords>
						<xsl:variable name="keyword">
							<xsl:for-each select="keywords/keyword">
								<xsl:value-of select="concat(style,';; ')"/>
							</xsl:for-each>
						</xsl:variable>
						<xsl:variable name="strlength">
							<xsl:value-of select="string-length($keyword)"/>
						</xsl:variable>
						<xsl:variable name="keywords">
							<xsl:value-of select="substring($keyword,1,($strlength) - 3)"/>
						</xsl:variable>
						<keyword>
							<xsl:value-of select="$keywords"/>
						</keyword>
					</keywords>
					<abstract>
						<p>
							<xsl:value-of select="abstract/style"/>
						</p>
					</abstract>
					<fulltext-url>
						<xsl:variable name="pdfpath">
							<xsl:value-of select="urls/pdf-urls/url"/>
						</xsl:variable>
						<xsl:call-template name="filename">
							<xsl:with-param name="path"
								select="substring-after($pdfpath, 'file://')"/>
						</xsl:call-template>
					</fulltext-url>
					<xsl:variable name="year">
						<xsl:value-of select="dates/year"/>
					</xsl:variable>
					<xsl:variable name="volume">
						<xsl:value-of select="volume/style"/>
					</xsl:variable>
					<xsl:variable name="issue">
						<xsl:value-of select="number/style"/>
					</xsl:variable>
					<xsl:variable name="pages">
						<xsl:value-of select="pages/style"/>
					</xsl:variable>
					<xsl:variable name="title">
						<xsl:value-of select="titles/secondary-title/style"/>
					</xsl:variable>
					<fields>
						<field name="Published In" type="string">
							<value>
								<xsl:if test="string-length($title) >0 ">
									<xsl:value-of select="concat($title,' ')"/>
								</xsl:if>
								<xsl:if test="string-length($volume) >0 ">
									<xsl:value-of select="concat($volume,',')"/>
								</xsl:if>
								<xsl:if test="string-length($issue) >0 ">
									<xsl:value-of select="concat($issue,' ')"/>
								</xsl:if>
								<xsl:if test="string-length($year) >0 ">
									<xsl:value-of select="'('"/>
									<xsl:value-of select="concat($year,') ')"/>
								</xsl:if>
								<xsl:if test="string-length($pages) >0 ">
									<xsl:value-of select="concat($pages,';')"/>
								</xsl:if>
							</value>
						</field>
					</fields>
				</document>
			</xsl:for-each>
		</documents>
	</xsl:template>
	<xsl:template name="filename">
		<xsl:param name="path"/>
		<xsl:choose>
			<xsl:when test="contains($path,'\')">
				<xsl:call-template name="filename">
					<xsl:with-param name="path" select="substring-after($path,'\')"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="link_files">
					<xsl:value-of select="'http://yourschool.edu/yourfolder/'"/>
				</xsl:variable>
				<xsl:value-of select="concat($link_files,$path)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
