Skip to content
Snippets Groups Projects
Commit 0bedb005 authored by Jens Kupferschmidt's avatar Jens Kupferschmidt
Browse files

first implementation for json-ld

parent 48166b91
Branches
No related merge requests found
No preview for this file type
No preview for this file type
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:schema="http://schema.org" exclude-result-prefixes="xlink xsl xs schema">
<xsl:import href="jsonld-common.xsl" />
<xsl:output method="text" media-type="application/ld+json" encoding="UTF-8" indent="yes" />
<xsl:param name="WebApplicationBaseURL" />
<xsl:param name="CurrentLang" />
<xsl:template match="/mycoreobject[contains(@ID,'_biocol_')]" mode="jsonld" priority="1">
<xsl:variable name="obj_id">
<xsl:value-of select="@ID" />
</xsl:variable>
<xsl:text>[{
"@context":
{
"schema":"http:\/\/schema.org\/",
"identifier":"schema:identifier",
"title":"schema:name"
"collection":"schema:description"
},
"@type":"schema:Thing",
</xsl:text>
<!-- ID -->
<xsl:text>&#xa;"@id":"</xsl:text>
<xsl:value-of select="concat($WebApplicationBaseURL,'receive/',./@ID)"/>
<xsl:text>"</xsl:text>
<!-- identifier -->
<xsl:if test="./metadata/def.biocol01">
<xsl:text>, &#xa;"identifier":"</xsl:text>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="./metadata/def.biocol01/biocol01" />
</xsl:call-template>
<xsl:text>"</xsl:text>
</xsl:if>
<!-- title -->
<xsl:text>, &#xa;"title":"</xsl:text>
<xsl:choose>
<xsl:when test="./metadata/def.biocol09">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="./metadata/def.biocol09/biocol09" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="./metadata/def.biocol30/biocol30" />
</xsl:call-template>
<xsl:text> - </xsl:text>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="./metadata/def.biocol31/biocol31" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:text>"</xsl:text>
<!-- collection -->
<xsl:if test="./metadata/def.biocol02">
<xsl:text>, &#xa;"collection":Universität Leipzig - "</xsl:text>
<xsl:call-template name="get_categ_content">
<xsl:with-param name="classid" select="./metadata/def.biocol02/biocol02/@classid" />
<xsl:with-param name="categid" select="./metadata/def.biocol02/biocol02/@categid" />
<xsl:with-param name="lang" select="$CurrentLang" />
</xsl:call-template>
<xsl:text>"</xsl:text>
</xsl:if>
<xsl:text>}]</xsl:text>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment