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, '"'), '"')"/>
|
---|
16 |
|
---|
17 | <xsl:if test="contains($pText, '"')">
|
---|
18 | <xsl:text>\"</xsl:text>
|
---|
19 |
|
---|
20 | <xsl:call-template name="escapeQuote">
|
---|
21 | <xsl:with-param name="pText" select=
|
---|
22 | "substring-after($pText, '"')"/>
|
---|
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: <http://purl.org/dc/elements/1.1/> .
|
---|
33 | @prefix bibo: <http://purl.org/ontology/bibo/> .
|
---|
34 | @prefix terms: <http://purl.org/terms/> .
|
---|
35 | @prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0#> .
|
---|
36 |
|
---|
37 | @prefix gsembedded: <http://greenstone.org/gsembedded#> .
|
---|
38 | @prefix gsextracted: <http://greenstone.org/gsextracted#> .
|
---|
39 | @prefix : <@libraryurl@/collection/@collect@/document/> .
|
---|
40 |
|
---|
41 | <xsl:apply-templates/>
|
---|
42 | </xsl:template>
|
---|
43 |
|
---|
44 | <xsl:template match="/Section/Description">
|
---|
45 |
|
---|
46 | :<xsl:value-of select="$docoid"/>
|
---|
47 |
|
---|
48 | dc:Relation.isPartOf <@libraryurl@/collection/@collect@> ;
|
---|
49 |
|
---|
50 | <xsl:for-each select="Metadata">
|
---|
51 |
|
---|
52 | <xsl:variable name="metaname" select="@name"/>
|
---|
53 | <!--
|
---|
54 | <xsl:variable name="metavalRaw"><xsl:value-of select="text()/></xsl:variable>
|
---|
55 | <xsl:variable name="metavalSingleLine"><xsl:value-of select="replace($metavalRaw,'\n',' ')"/></xsl:variable>
|
---|
56 | -->
|
---|
57 |
|
---|
58 | <xsl:variable name="metaval"><xsl:call-template name="escapeQuote"><xsl:with-param name="pText" select="text()"/></xsl:call-template></xsl:variable>
|
---|
59 | <!--
|
---|
60 | <xsl:variable name="metaval"><xsl:value-of select="replace($metavalEsc, '\n', '<br />')"/></xsl:variable>
|
---|
61 | -->
|
---|
62 | <!--
|
---|
63 | <xsl:variable name="metaval"><xsl:value-of select="$metavalEsc/></xsl:variable>
|
---|
64 | -->
|
---|
65 |
|
---|
66 | <xsl:if test="starts-with($metaname,'dc.')">
|
---|
67 | <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,4)"/></xsl:variable>
|
---|
68 | dc:<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>"<xsl:value-of select="$metaval"/>"<xsl:text> ;</xsl:text>
|
---|
69 | </xsl:if>
|
---|
70 |
|
---|
71 | <xsl:if test="starts-with($metaname,'ex.')">
|
---|
72 | <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,4)"/></xsl:variable>
|
---|
73 | gsembedded:<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>"<xsl:value-of select="$metaval"/>"<xsl:text> ;</xsl:text>
|
---|
74 | </xsl:if>
|
---|
75 |
|
---|
76 | <xsl:if test="starts-with($metaname,'nz.')">
|
---|
77 | <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,4)"/></xsl:variable>
|
---|
78 | gsembedded:<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>"<xsl:value-of select="$metaval"/>"<xsl:text> ;</xsl:text>
|
---|
79 | </xsl:if>
|
---|
80 |
|
---|
81 | <xsl:if test="starts-with($metaname,'bibo.')">
|
---|
82 | <xsl:variable name="metanameSuffix"><xsl:value-of select="substring($metaname,6)"/></xsl:variable>
|
---|
83 | bibo:<xsl:value-of select="$metanameSuffix"/><xsl:text> </xsl:text>"<xsl:value-of select="$metaval"/>"<xsl:text> ;</xsl:text>
|
---|
84 | </xsl:if>
|
---|
85 |
|
---|
86 | <!-- <xsl:if test="not(contains($metaname,'.'))">
|
---|
87 | gsextracted:<xsl:value-of select="$metaname"/><xsl:text> </xsl:text>"<xsl:value-of select="$metaval"/>"<xsl:text> ;</xsl:text>
|
---|
88 | </xsl:if>
|
---|
89 | -->
|
---|
90 | </xsl:for-each>
|
---|
91 | .
|
---|
92 | </xsl:template>
|
---|
93 |
|
---|
94 | <!-- *** Update to include section level metadata -->
|
---|
95 |
|
---|
96 | <xsl:template match="/Section/Content">
|
---|
97 | <!-- Full text is supressed for now -->
|
---|
98 | </xsl:template>
|
---|
99 |
|
---|
100 | </xsl:stylesheet>
|
---|
101 |
|
---|