<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   version="1.0">

<xsl:output method="xml" encoding="utf-8" indent="yes"/>

<xsl:template match="/">
	    <xsl:apply-templates select="Records"/>
</xsl:template>

<xsl:template match="Records">
	<xsl:copy>
	    <xsl:apply-templates select="record"/>
	</xsl:copy>
</xsl:template>

<xsl:template match="record">
	<xsl:copy>
		<xsl:apply-templates select="header"/>
		<xsl:apply-templates select="metadata"/>
		<xsl:apply-templates select="about"/>
	</xsl:copy>
</xsl:template>

<xsl:template match="header|about|dc:title|dc:creator|dc:subject|dc:description|dc:publisher|dc:contributor|dc:date|dc:format|dc:identifier|dc:source|dc:language|dc:relation|dc:coverage|dc:rights">
	<!-- copy this element and all its children i.e the subtree -->
	<xsl:copy-of select="current()"/>
<!--	<xsl:text> -->
<!--	</xsl:text> -->
</xsl:template>

<xsl:template match="metadata">
	<xsl:copy>
	<xsl:apply-templates select="dc:dc"/>
	</xsl:copy>
</xsl:template>

<xsl:template match="dc:dc">
	<xsl:copy>
	<xsl:apply-templates />
	</xsl:copy>
</xsl:template>

<xsl:template match="dc:type">
  <xsl:choose>
    <xsl:when test="contains(.,'Governmental Bodies')">
      <xsl:copy>^M
        <xsl:text>Organisation</xsl:text>
      </xsl:copy>^M
    </xsl:when>
    <xsl:when test="contains(.,'Tutorials')">
      <xsl:copy>^M
        <xsl:text>LearningMaterialCourseware</xsl:text>
      </xsl:copy>^M
    </xsl:when>
    <xsl:otherwise>
      <xsl:copy-of select="current()"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
</xsl:stylesheet>

