source: main/trunk/model-sites-dev/von-sparql/collect/nz-natlib-cat/etc/gsdom2rdf.xsl@ 29437

Last change on this file since 29437 was 29437, checked in by sjs49, 9 years ago

Modified gsdom2rdf.xsl for hathi and NZ collections to remove use of Relation.isPartOf for our old Sparql queries, and make contents of gsdom2rdf the same across all our collections

  • Property svn:executable set to *
File size: 4.5 KB
RevLine 
[28920]1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 extension-element-prefixes="java"
6 exclude-result-prefixes="java">
7
8 <xsl:output method="text"/>
9
10
11 <xsl:template name="escapeQuote">
12 <xsl:param name="pText" select="."/>
13
14 <xsl:if test="string-length($pText) >0">
15 <xsl:value-of select="substring-before(concat($pText, '&quot;'), '&quot;')"/>
16
17 <xsl:if test="contains($pText, '&quot;')">
18 <xsl:text>\"</xsl:text>
19
20 <xsl:call-template name="escapeQuote">
21 <xsl:with-param name="pText" select=
22 "substring-after($pText, '&quot;')"/>
23 </xsl:call-template>
24 </xsl:if>
25 </xsl:if>
26 </xsl:template>
27
28
29 <xsl:variable name="docoid"><xsl:value-of select="/Section/Description/Metadata[@name='Identifier']"/></xsl:variable>
30
31 <xsl:template match="/">
32@prefix dc: &lt;http://purl.org/dc/elements/1.1/&gt; .
33@prefix bibo: &lt;http://purl.org/ontology/bibo/&gt; .
34@prefix terms: &lt;http://purl.org/terms/&gt; .
35@prefix vcard: &lt;http://www.w3.org/2001/vcard-rdf/3.0#&gt; .
36
37@prefix gsembedded: &lt;http://greenstone.org/gsembedded#&gt; .
38@prefix gsextracted: &lt;http://greenstone.org/gsextracted#&gt; .
39@prefix : &lt;@libraryurl@/collection/@collect@/document/&gt; .
40
41 <xsl:apply-templates/>
42 </xsl:template>
43
44 <xsl:template match="/Section/Description">
45
46:<xsl:value-of select="$docoid"/>
47
48 <xsl:for-each select="Metadata">
49
50 <xsl:variable name="metaname" select="@name"/>
51<!--
52 <xsl:variable name="metavalRaw"><xsl:value-of select="text()/></xsl:variable>
53 <xsl:variable name="metavalSingleLine"><xsl:value-of select="replace($metavalRaw,'\n',' ')"/></xsl:variable>
54-->
55
56 <xsl:variable name="metaval"><xsl:call-template name="escapeQuote"><xsl:with-param name="pText" select="text()"/></xsl:call-template></xsl:variable>
57<!--
58 <xsl:variable name="metaval"><xsl:value-of select="replace($metavalEsc, '\n', '&lt;br /&gt;')"/></xsl:variable>
59-->
60<!--
61 <xsl:variable name="metaval"><xsl:value-of select="$metavalEsc/></xsl:variable>
62-->
63
64 <xsl:if test="starts-with($metaname,'dc.')">
65 <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,4)"/></xsl:variable>
66 dc:<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>&quot;<xsl:value-of select="$metaval"/>&quot;<xsl:text> ;</xsl:text>
67 </xsl:if>
68
69 <xsl:if test="starts-with($metaname,'ex.')">
70 <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,4)"/></xsl:variable>
71 gsembedded:<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>&quot;<xsl:value-of select="$metaval"/>&quot;<xsl:text> ;</xsl:text>
72 </xsl:if>
73
74 <xsl:if test="starts-with($metaname,'nz.')">
75 <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,4)"/></xsl:variable>
76 gsembedded:<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>&quot;<xsl:value-of select="$metaval"/>&quot;<xsl:text> ;</xsl:text>
77 </xsl:if>
78
[29435]79 <xsl:if test="starts-with($metaname,'hathi.')">
80 <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,7)"/></xsl:variable>
81 gsembedded:hathi.<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>&quot;<xsl:value-of select="$metaval"/>&quot;<xsl:text> ;</xsl:text>
82 </xsl:if>
83
84 <xsl:if test="starts-with($metaname,'marc.')">
85 <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,6)"/></xsl:variable>
86 gsembedded:hathimarc.<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>&quot;<xsl:value-of select="$metaval"/>&quot;<xsl:text> ;</xsl:text>
87 </xsl:if>
88
[28920]89 <xsl:if test="starts-with($metaname,'bibo.')">
90 <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,6)"/></xsl:variable>
91 bibo:<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>&quot;<xsl:value-of select="$metaval"/>&quot;<xsl:text> ;</xsl:text>
92 </xsl:if>
93
[29435]94<!-- <xsl:if test="not(contains($metaname,'.'))">
[28920]95 gsextracted:<xsl:value-of select="$metaname"/><xsl:text> </xsl:text>&quot;<xsl:value-of select="$metaval"/>&quot;<xsl:text> ;</xsl:text>
96 </xsl:if>
97 -->
98 </xsl:for-each>
99 .
100 </xsl:template>
101
102 <!-- *** Update to include section level metadata -->
103
104 <xsl:template match="/Section/Content">
105 <!-- Full text is supressed for now -->
106 </xsl:template>
107
108</xsl:stylesheet>
109
Note: See TracBrowser for help on using the repository browser.