<?xml version="1.0" encoding="UTF-8"?>
<!-- courtesy of Bruce D'Arcus: http://groups.google.com/group/bibliographic-ontology-specification-group/browse_frm/thread/80937796903dd62b
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:srw="http://www.loc.gov/zing/srw/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" version="1.0">
  <xsl:template match="/srw:searchRetrieveResponse">
    <rdf:RDF>
      <xsl:apply-templates select="srw:records"/>
    </rdf:RDF>
  </xsl:template>
  <xsl:template match="srw:records">
    <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="srw:record">
    <xsl:apply-templates select="srw:recordData"/>
  </xsl:template>
  <xsl:template match="srw:recordData">
    <rdf:Description rdf:about="http://orlabs.oclc.org/Identities/key/{*/pnkey}">
      <xsl:apply-templates select="Identity"/>
    </rdf:Description>
  </xsl:template>
  <xsl:template match="Identity">
    <xsl:variable name="type">
      <xsl:choose>
        <xsl:when test="@type='personal'">
          <xsl:text>http://xmlns.com/foaf/0.1/Person</xsl:text>
        </xsl:when>
        <xsl:when test="@type='corporate'">
          <xsl:text>http://xmlns.com/foaf/0.1/Organization</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>http://xmlns.com/foaf/0.1/Agent</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <rdf:type rdf:resource="{$type}"/>
    <xsl:apply-templates select="authorityInfo"/>
    <xsl:apply-templates select="by"/>
  </xsl:template>
  <xsl:template match="authorityInfo">
    <xsl:apply-templates select="standardForm"/>
  </xsl:template>
  <xsl:template match="standardForm">
    <foaf:name>
      <xsl:value-of select="suba"/>
    </foaf:name>
  </xsl:template>
  <xsl:template match="by">
    <xsl:apply-templates select="citation">
      <xsl:with-param name="ctype" select="'By'"/>
    </xsl:apply-templates>
  </xsl:template>
  <xsl:template match="citation">
    <xsl:param name="ctype"/>
    <xsl:variable name="oclc-stripped" select="substring-after(oclcnum,                                                                                                                                                                                                                                       'ocn')"/>
    <xsl:choose>
      <xsl:when test="$ctype='By'">
        <foaf:made rdf:resource="http://worldcat.org/oclc/{$oclc-stripped}"/>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>
