13 |
13 |
<TITLE>XSLT transform from mediawiki to eagle</TITLE>
|
14 |
14 |
<CODE><![CDATA[
|
15 |
15 |
<xsl:stylesheet version="2.0"
|
16 |
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnet="eu.dnetlib.miscutils.functional.xml.DnetXsltFunctions"
|
17 |
|
xmlns:utils="eu.dnetlib.miscutils.datetime.DateUtils" xmlns:tei="http://www.tei-c.org/ns/1.0"
|
18 |
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
19 |
|
exclude-result-prefixes="xsl tei dnet utils">
|
20 |
|
|
21 |
|
<xsl:output indent="yes" encoding="UTF-8"/>
|
22 |
|
|
23 |
|
<xsl:variable name="REPO_ACRONYM" select="//*[local-name()='datasourceprefix']" />
|
24 |
|
<xsl:param name="varOfficialName" />
|
25 |
|
|
26 |
|
<xsl:variable name="REPO_ID" select="//dri:repositoryId" />
|
27 |
|
<xsl:variable name="ORIG_OBJ_ID" select="//dri:objIdentifier" />
|
28 |
|
|
29 |
|
<xsl:variable name="NOW" select="utils:now_ISO8601()" />
|
30 |
|
|
31 |
|
|
|
16 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnet="eu.dnetlib.miscutils.functional.xml.DnetXsltFunctions"
|
|
17 |
xmlns:utils="eu.dnetlib.miscutils.datetime.DateUtils" xmlns:tei="http://www.tei-c.org/ns/1.0"
|
|
18 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
|
19 |
exclude-result-prefixes="xsl tei dnet utils">
|
|
20 |
|
|
21 |
<xsl:output indent="yes" />
|
|
22 |
|
|
23 |
<xsl:param name="varOfficialName" />
|
|
24 |
|
|
25 |
<xsl:variable name="REPO_ID" select="//dri:repositoryId" />
|
|
26 |
<xsl:variable name="ORIG_OBJ_ID" select="//dri:objIdentifier" />
|
|
27 |
<xsl:variable name="NOW" select="utils:now_ISO8601()" />
|
|
28 |
<xsl:variable name="LOCAL_ID" select="//entity/@id" />
|
|
29 |
<xsl:variable name="LOCAL_ID_MD5" select="dnet:md5($LOCAL_ID)" />
|
|
30 |
<xsl:variable name="DATE_EDITED" select="//entity/@_modified_" />
|
|
31 |
|
|
32 |
<xsl:template match="/">
|
|
33 |
<package>
|
|
34 |
<xsl:for-each select="//property[@id='p11' or @id='p12' or
|
|
35 |
@id='p13' or @id='p14' or
|
|
36 |
@id='p15' or @id='p16' or
|
|
37 |
@id='p17' or @id='p18' or
|
|
38 |
@id='p19' or @id='p20' or
|
|
39 |
@id='p57' or @id='p67' or
|
|
40 |
@id='p61']/claim">
|
|
41 |
<record>
|
|
42 |
<header>
|
|
43 |
<dri:objIdentifier>
|
|
44 |
<xsl:value-of select="concat($ORIG_OBJ_ID,'::', ./@id, '_translation')" />
|
|
45 |
</dri:objIdentifier>
|
|
46 |
<dri:dateOfCollection>
|
|
47 |
<xsl:value-of select="$NOW" />
|
|
48 |
</dri:dateOfCollection>
|
|
49 |
<dri:repositoryId>
|
|
50 |
<xsl:value-of select="$REPO_ID" />
|
|
51 |
</dri:repositoryId>
|
|
52 |
</header>
|
|
53 |
<metadata>
|
|
54 |
<eagleObject>
|
|
55 |
<dnetResourceIdentifier>
|
|
56 |
<xsl:value-of select="concat($ORIG_OBJ_ID,'::', ./@id, '_translation')" />
|
|
57 |
</dnetResourceIdentifier>
|
|
58 |
<recordSourceInfo providerName="{$varOfficialName}" providerAcronym="MW" landingPage="http://www.eagle-network.eu/wiki/index.php/Main_Page">
|
|
59 |
<xsl:value-of select="$LOCAL_ID" />
|
|
60 |
</recordSourceInfo>
|
|
61 |
<editingInfo>
|
|
62 |
<dateEdited>
|
|
63 |
<xsl:value-of select="$DATE_EDITED" />
|
|
64 |
</dateEdited>
|
|
65 |
<metadataEditor>Eagle mediawiki</metadataEditor>
|
|
66 |
</editingInfo>
|
|
67 |
<metadataIpr />
|
|
68 |
<xsl:for-each select="//description">
|
|
69 |
<title lang="{./@language}">
|
|
70 |
<xsl:value-of select="./@value" />
|
|
71 |
</title>
|
|
72 |
</xsl:for-each>
|
|
73 |
<xsl:for-each select="//description">
|
|
74 |
<description lang="{./@language}">
|
|
75 |
<xsl:value-of select="./@value" />
|
|
76 |
</description>
|
|
77 |
</xsl:for-each>
|
|
78 |
<entityType>documental</entityType>
|
|
79 |
<documentalManifestation>
|
|
80 |
<documentType>translation</documentType>
|
|
81 |
<xsl:for-each select="//property[@id='p22' or @id='p24' or
|
|
82 |
@id='p33' or @id='p34' or
|
|
83 |
@id='p35' or @id='p36' or
|
|
84 |
@id='p37' or @id='p38' or
|
|
85 |
@id='p39' or @id='p40' or
|
|
86 |
@id='p48' or @id='p59' or
|
|
87 |
@id='p22' or @id='p24']">
|
|
88 |
<hasArtifact>
|
|
89 |
<dnetResourceIdentifier>
|
|
90 |
<xsl:value-of select="concat(@id, '::', dnet:md5(./claim/mainsnak/datavalue/@value), '::artifact')"></xsl:value-of>
|
|
91 |
</dnetResourceIdentifier>
|
|
92 |
<recordSourceInfo providerName="" providerAcronym="" landingPage="">
|
|
93 |
<xsl:value-of select="./claim/mainsnak/datavalue/@value" />
|
|
94 |
</recordSourceInfo>
|
|
95 |
<hasTmId>
|
|
96 |
<tmId>
|
|
97 |
<xsl:value-of select="//mainsnak[@property='p3']/datavalue/@value"></xsl:value-of>
|
|
98 |
</tmId>
|
|
99 |
</hasTmId>
|
|
100 |
<objectType></objectType>
|
|
101 |
<material></material>
|
|
102 |
</hasArtifact>
|
|
103 |
</xsl:for-each>
|
|
104 |
<translation>
|
|
105 |
<text lang="">
|
|
106 |
<xsl:value-of select="./mainsnak/datavalue/@value"></xsl:value-of>
|
|
107 |
</text>
|
|
108 |
<mediawikiUrl>
|
|
109 |
<xsl:value-of select="concat('http://www.eagle-network.eu/wiki/index.php/Item:', $LOCAL_ID)" />
|
|
110 |
</mediawikiUrl>
|
|
111 |
<notes></notes>
|
|
112 |
<author>
|
|
113 |
<xsl:value-of select=".//snak[@property='p21']/datavalue/@value" />
|
|
114 |
</author>
|
|
115 |
<translationIpr uri="">
|
|
116 |
<xsl:choose>
|
|
117 |
<xsl:when test=".//snak[@property='p25']/datavalue/@value != ''">
|
|
118 |
<xsl:value-of select=".//snak[@property='p25']/datavalue/@value" />
|
|
119 |
</xsl:when>
|
|
120 |
<xsl:otherwise>
|
|
121 |
<xsl:choose>
|
|
122 |
<xsl:when test="//mainsnak[@property='p25']/datavalue/@value != ''">
|
|
123 |
<xsl:value-of select="//mainsnak[@property='p25']/datavalue/@value" />
|
|
124 |
</xsl:when>
|
|
125 |
<xsl:otherwise>CC0 - No rights reserved</xsl:otherwise>
|
|
126 |
</xsl:choose>
|
|
127 |
</xsl:otherwise>
|
|
128 |
</xsl:choose>
|
|
129 |
</translationIpr>
|
|
130 |
<publicationTitle>
|
|
131 |
<xsl:value-of select=".//snak[@property='p26']/datavalue/@value" />
|
|
132 |
</publicationTitle>
|
|
133 |
<publicationYear>
|
|
134 |
<xsl:value-of select=".//snak[@property='p29']/datavalue/@value" />
|
|
135 |
</publicationYear>
|
|
136 |
<publicationAuthor>
|
|
137 |
<xsl:value-of select=".//snak[@property='p46']/datavalue/@value" />
|
|
138 |
</publicationAuthor>
|
|
139 |
<publicationEditor>
|
|
140 |
<xsl:value-of select=".//snak[@property='p41']/datavalue/@value" />
|
|
141 |
</publicationEditor>
|
|
142 |
<publicationPlace>
|
|
143 |
<xsl:value-of select=".//snak[@property='p28']/datavalue/@value" />
|
|
144 |
</publicationPlace>
|
|
145 |
<hasTranscription>
|
|
146 |
<dnetResourceIdentifier></dnetResourceIdentifier>
|
|
147 |
<recordSourceInfo></recordSourceInfo>
|
|
148 |
<text></text>
|
|
149 |
</hasTranscription>
|
|
150 |
</translation>
|
|
151 |
</documentalManifestation>
|
|
152 |
</eagleObject>
|
|
153 |
</metadata>
|
|
154 |
</record>
|
|
155 |
</xsl:for-each>
|
|
156 |
</package>
|
|
157 |
</xsl:template>
|
32 |
158 |
</xsl:stylesheet>
|
33 |
159 |
]]></CODE>
|
34 |
160 |
</SCRIPT>
|
mediawiki rule updated