<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:dcterms="http://purl.org/dc/terms/"
  exclude-result-prefixes="dcterms"
	version="1.0">

	<!-- *****************************************************************************

	<dc:title>DCDD.xsl</dc:title>
	<dc:creator>Tom Habing, thabing@uiuc.edu</dc:creator>
	<dc:description>Dumb-down Qualified Dublin Core Refinements to their equivalent
	simple elements, leaving the rest of the XML document unchanged.  Uses a hardcoded
	mapping string to find the simple DC equivalents of the refined elements</dc:description>
	<dc:date>2002-07-08</dc:date>

	********************************************************************************* -->

	<xsl:output method="xml" encoding="UTF-8" indent="yes"/>

	<!-- the leading and trailing spaces in the following string are significant -->
	<xsl:variable name="MAPPING"> alternative=title tableOfContents=description abstract=description created=date valid=date available=date issued=date modified=date extent=format medium=format isVersionOf=relation hasVersion=relation isReplacedBy=relation replaces=relation isRequiredBy=relation requires=relation isPartOf=relation hasPart=relation isReferencedBy=relation references=relation isFormatOf=relation hasFormat=relation spatial=coverage temporal=coverage </xsl:variable>

	<xsl:template match="/">
		<xsl:apply-templates select="node() | @*"/>
	</xsl:template>

	<xsl:template match="dcterms:*">
		<xsl:if test="contains($MAPPING,concat(' ',local-name(.),'='))">
  		<xsl:element namespace="http://purl.org/dc/elements/1.1/" name="{concat('dc:',substring-before(substring-after($MAPPING,concat(' ',local-name(.),'=')),' '))}">
  			<xsl:apply-templates select="@*"/>
  			<xsl:value-of select="."/>
  		</xsl:element>
  	</xsl:if>
	</xsl:template>

	<xsl:template match="node() | @*">
		<xsl:copy>
			<xsl:apply-templates select="node() | @*"/>
		</xsl:copy>
	</xsl:template>

</xsl:stylesheet>
