Skip to content
Snippets Groups Projects
Commit c223cb87 authored by David Maus's avatar David Maus
Browse files

MODS für OPAC Titeldaten

parent 62e9eeac
No related branches found
No related tags found
No related merge requests found
......@@ -67,18 +67,34 @@ switch ($format) {
$content = $writer->write($record);
$response = new Response($content, 200, array('Content-Type' => 'application/xml'));
break;
case 'mods':
$type = (string)$record->getFirstMatchingField('002@/00')->getNthSubfield(0, '0');
if ($type[0] === 'T') {
$response = new Response('<h1>406 Not Acceptable</h1>', 406, array('Content-Type' => 'text/html'));
} else {
$templateUri = __DIR__ . '/../../../../src/xslt/pica/mods.xsl';
$sourceUri = sprintf(PICA_TEMPLATE, $ident);
$content = transform($sourceUri, $templateUri);
if ($content) {
$response = new Response($content, 200, array('Content-Type' => 'application/rdf+xml'));
break;
}
}
$response = new Response('<h1>406 Not Acceptable</h1>', 406, array('Content-Type' => 'text/html'));
break;
case 'rdf':
$type = (string)$record->getFirstMatchingField('002@/00')->getNthSubfield(0, '0');
if ($type[0] === 'T') {
$templateUri = __DIR__ . '/../../../../src/xslt/pica/auth.xsl';
$sourceUri = sprintf(PICA_TEMPLATE, $ident);
$templateUri = __DIR__ . '/../../../../src/xslt/pica2skos.xsl';
$content = transform($sourceUri, $templateUri);
if ($content) {
$response = new Response($content, 200, array('Content-Type' => 'application/rdf+xml'));
break;
}
}
// Fall through
$response = new Response('<h1>406 Not Acceptable</h1>', 406, array('Content-Type' => 'text/html'));
break;
default:
$response = new Response('<h1>406 Not Acceptable</h1>', 406, array('Content-Type' => 'text/html'));
}
......
File moved
<xsl:transform version="1.0"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:pica="info:srw/schema/5/picaXML-v1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="pica:record">
<xsl:variable name="recordType" select="substring(pica:datafield[@tag = '002@']/pica:subfield[@code = '0'], 2, 1)"/>
<mods:mods>
<xsl:choose>
<xsl:when test="pica:datafield[@tag = '021A']">
<xsl:call-template name="mods:titleInfo">
<xsl:with-param name="titleField" select="pica:datafield[@tag = '021A']"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</mods:mods>
</xsl:template>
<xsl:template name="mods:titleInfo">
<xsl:param name="titleField"/>
<mods:titleInfo>
<xsl:choose>
<xsl:when test="contains($titleField/pica:subfield[@code = 'a'], '@')">
<xsl:if test="substring-before($titleField/pica:subfield[@code = 'a'], '@')">
<mods:nonSort>
<xsl:value-of select="substring-before($titleField/pica:subfield[@code = 'a'], '@')"/>
</mods:nonSort>
<mods:title>
<xsl:value-of select="substring-after($titleField/pica:subfield[@code = 'a'], '@')"/>
</mods:title>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<mods:title>
<xsl:value-of select="$titleField/pica:subfield[@code = 'a']"/>
</mods:title>
</xsl:otherwise>
</xsl:choose>
</mods:titleInfo>
</xsl:template>
</xsl:transform>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment