-
Notifications
You must be signed in to change notification settings - Fork 0
/
dc2rdf.xslt
36 lines (35 loc) · 2.3 KB
/
dc2rdf.xslt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/terms/" xmlns:lmdr="http://spider.sigappfr.org/linkedmdr/#">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:variable name="document" select="substring-after(DCmetadata/dc:identifier/text(),'uploads\')" />
<xsl:template match="/">
<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE rdf:RDF [
<!ENTITY lmdr "http://spider.sigappfr.org/linkedmdr/#" >
<!ENTITY dc "http://purl.org/dc/terms/" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >]>]]>
</xsl:text>
<xsl:text disable-output-escaping="yes"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:lmdr="http://spider.sigappfr.org/linkedmdr/#"
xmlns:dc="http://purl.org/dc/terms/#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<rdf:Description rdf:about="&lmdr;</xsl:text><xsl:value-of select="$document"/>
<xsl:text disable-output-escaping="yes">">
<rdf:type rdf:resource="&lmdr;Document"/></xsl:text>
<xsl:for-each select="DCmetadata/*">
<xsl:text disable-output-escaping="yes">
<lmdr:hasProperty rdf:resource="&lmdr;</xsl:text><xsl:value-of select="concat($document,'.',local-name(.),'.',generate-id(.))"/><xsl:text disable-output-escaping="yes">"/></xsl:text>
</xsl:for-each>
<xsl:text disable-output-escaping="yes">
</rdf:Description></xsl:text>
<xsl:for-each select="DCmetadata/*">
<xsl:text disable-output-escaping="yes">
<rdf:Description rdf:about="&lmdr;</xsl:text><xsl:value-of select="concat($document,'.',local-name(.),'.',generate-id(.))"/>
<xsl:text disable-output-escaping="yes">">
<rdf:type rdf:resource="&dc;</xsl:text><xsl:value-of select="local-name(.)"/><xsl:text disable-output-escaping="yes">"/>
<lmdr:hasValue></xsl:text><xsl:value-of select="."></xsl:value-of>
<xsl:text disable-output-escaping="yes"><lmdr:hasValue>
</rdf:Description></xsl:text>
</xsl:for-each>
<xsl:text disable-output-escaping="yes"></rdf:RDF></xsl:text>
</xsl:template>
</xsl:stylesheet>