<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:rss="http://purl.org/rss/1.0/" xmlns="http://www.loc.gov/mods/v3"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:prism="http://prismstandard.org/namespaces/1.2/basic/" exclude-result-prefixes="prism rss rdf dc">
  <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
  <xsl:strip-space elements="*"/>
  <!-- PRISM to MODS XSLT; copyright Bruce D'Arcus, 2004 -->
  <xsl:variable name="publication" select="//prism:publicationName"/>
  <xsl:variable name="datePublished" select="//prism:coverDisplayDate"/>
  <xsl:template match="/">
    <modsCollection>
      <xsl:apply-templates select="//rss:item"/>
    </modsCollection>
  </xsl:template>
  <xsl:template match="rss:item">
    <mods>
      <xsl:apply-templates select="dc:title"/>
      <xsl:apply-templates select="dc:creator"/>
      <relatedItem type="host">
        <titleInfo>
          <title>
            <xsl:value-of select="$publication"/>
          </title>
        </titleInfo>
        <originInfo>
          <dateIssued>
            <xsl:value-of select="$datePublished"/>
          </dateIssued>
        </originInfo>
        <part>
          <xsl:apply-templates select="prism:volume"/>
          <xsl:apply-templates select="prism:number"/>
          <xsl:apply-templates select="prism:startingPage"/>
        </part>
      </relatedItem>
      <xsl:apply-templates select="dc:identifier"/>
    </mods>
  </xsl:template>
  <xsl:template match="dc:title">
    <titleInfo>
      <title>
        <xsl:value-of select="substring-before(., ': ')"/>
      </title>
      <subTitle>
        <xsl:value-of select="substring-after(., ': ')"/>
      </subTitle>
    </titleInfo>
  </xsl:template>
  <xsl:template match="dc:creator">
    <name type="persaonal">
      <namePart type="given">
        <xsl:value-of select="substring-before(., ' ')"/>
      </namePart>
      <namePart type="family">
        <xsl:value-of select="substring-after(., ' ')"/>
      </namePart>
    </name>
  </xsl:template>
  <xsl:template match="prism:volume">
    <detail type="volume">
      <number>
        <xsl:value-of select="."/>
      </number>
    </detail>
  </xsl:template>
  <xsl:template match="prism:number">
    <detail type="issue">
      <number>
        <xsl:value-of select="."/>
      </number>
    </detail>
  </xsl:template>
  <xsl:template match="prism:startingPage">
    <range units="pages">
      <start>
        <xsl:value-of select="."/>
      </start>
    </range>
  </xsl:template>
  <xsl:template match="dc:title">
    <titleInfo>
      <title>
        <xsl:value-of select="substring-before(., ': ')"/>
      </title>
      <subTitle>
        <xsl:value-of select="substring-after(., ': ')"/>
      </subTitle>
    </titleInfo>
  </xsl:template>
</xsl:stylesheet>
