EPrints Technical Mailing List Archive

Message: #05891

< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Atom.xsl Patch Submission

Hello everyone,

I have found the reason why the category id and subjects are not recognized when depositing files in E-Prints using the Atom Publishing Protocol. The XSLT stylesheet 'Atom.xsl' [0]  in the Import directory does not handle those elements when converting Atom to EPrints XML.

Please find attached a version of the file which handles the dcterms:type and dcterms:subject terms and translates them into E-Prints XML. The dcterms vocabulry seems to be widely used in SWORD protocol implementations (i.e. [1]).

Additionally, I corrected a line in the stylesheet which transforms a submitted eprints status. The line checked for the status being equal to 'MailScanner has detected a possible fraud attempt from "yomiko.ecs.soton.ac.uk80" claiming to be http://yomiko.ecs.soton.ac.uk:8080/data/eprint/status/'. It seems to me that this is a concrete EPrints instance, so the line would not work for any other EPrints instance. I changed the line to: 'contains(@scheme,'/eprint/status')'. This should work for all EPrints instances, including my test server.

Please let me know if you will be including my patch into the repository.

Thank you,


[0] perl_lib/EPrints/Plugin/Import/XSLT/Atom.xsl
[1] http://guides.dataverse.org/en/latest/api/sword.html

Semiodesk GmbH | Werner-von-Siemens-Str. 6 Geb. 15k, 86159 Augsburg, Germany Phone: +49 821 8854401 | Fax: +49 821 8854410 | www.semiodesk.com

This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with us by e-mail is deemed to have accepted these risks. Semiodesk GmbH is not responsible for errors or omissions in this message and denies any responsibility for any damage arising from the use of e-mail. Any opinion and other statement contained in this message and any attachment are solely those of the author and do not necessarily represent those of the company.

<?xml version="1.0"?> 
<!-- identity transformation -->
	ept:name="Atom XML"
	ept:accept="application/atom+xml; type=entry"
	<xsl:output method="xml" indent="yes" encoding="utf-8"/>
	<xsl:template match="/">
				<xsl:if test="atom:entry/atom:author">
						<xsl:for-each select="atom:entry/atom:author">
									<xsl:call-template name="printname">
										<xsl:with-param name="fullname" select="normalize-space(./atom:name)"/>
										<xsl:with-param name="lastname" select="normalize-space(./atom:name)"/>
									<xsl:value-of select="./atom:email"/>
				<xsl:if test="atom:entry/atom:link">
						<xsl:for-each select="atom:entry/atom:link">
									<xsl:value-of select="@href"/>
				<xsl:if test="atom:entry/atom:contributor or atom:entry/atom:rights">
						<xsl:for-each select="atom:entry/atom:contributor">
							<xsl:value-of select="./atom:name"/> &lt;<xsl:value-of select="./atom:email"/>&gt;<br/>
						<xsl:if test="atom:entry/atom:rights">
Rights: <xsl:value-of select="atom:entry/atom:rights"/>
				<xsl:if test="atom:entry/dcterms:subject">
						<xsl:for-each select="atom:entry/dcterms:subject">
								<xsl:value-of select="." />
				<xsl:apply-templates select="atom:entry/*" />
	<xsl:template match="atom:category">
		<xsl:if test="contains(@scheme,'/eprint/status')">
				<xsl:value-of select="@term" />
	<xsl:template match="dcterms:type">
			<xsl:value-of select="." />
	<xsl:template match="atom:title">
			<xsl:value-of select="." />
	<xsl:template match="atom:summary">
			<xsl:value-of select="." />
	<xsl:template name="printname" mode="printname">
		<xsl:param name="fullname" />
		<xsl:param name="lastname" />
			<xsl:when test="contains($lastname, ' ')">
				<xsl:call-template name="printname">
					<xsl:with-param name="fullname" select="$fullname"/>
					<xsl:with-param name="lastname" select="substring-after($lastname, ' ')"/>
					<xsl:value-of select="substring-before($fullname,concat(' ', $lastname))"/>
					<xsl:value-of select="$lastname"/>

	<!-- Ignored -->
	<xsl:template match="atom:rights|atom:contributor|atom:author|atom:link|atom:updated|atom:published|dcterms:subject" />