-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter.xsl
More file actions
120 lines (103 loc) · 3.85 KB
/
filter.xsl
File metadata and controls
120 lines (103 loc) · 3.85 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<!-- redacts records and parts of records, for public consumption -->
<xsl:param name="dataset"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="($dataset='internal')">
<!-- redact and normalize internal data -->
<xsl:apply-templates mode="internal" select="/"/>
</xsl:when>
<xsl:otherwise>
<!-- redact non-public data -->
<xsl:apply-templates mode="public" select="/"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- identity template copies anything which isn't explicitly excluded by a more specific rule -->
<xsl:template mode="internal" match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="internal"/>
</xsl:copy>
</xsl:template>
<!-- for the "internal" dataset, ADD default rights data if missing altogether -->
<xsl:template mode="internal" match="record[not(normalize-space(AcsCCStatus))]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="internal"/>
<AcsCCStatus>Status not evaluated</AcsCCStatus>
<AcsCCRestrictionReason>Copyright has not yet been determined; please contact the National Museum of Australia to request clearance before re-use.</AcsCCRestrictionReason>
</xsl:copy>
</xsl:template>
<!-- identity template copies anything which isn't explicitly excluded by a more specific rule -->
<xsl:template mode="public" match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="public"/>
</xsl:copy>
</xsl:template>
<!-- redaction rules -->
<!-- exclude object record whose status isn’t either “Public” or “Public Restricted" or "Removed" -->
<xsl:template mode="public" match="
record
[TitObjectType]
[
not(
AcsAPI_tab/AcsAPI = ('Public', 'Public Restricted', 'Removed')
)
]
">
<xsl:copy/><!-- copies an empty <record> root element which will then be ignored -->
</xsl:template>
<!-- exclude a narrative's reference to an object, if that object's status isn’t either “Public” or “Public Restricted -->
<xsl:template mode="public" match="
record/ObjObjectsRef_tab/ObjObjectsRef
[
not(
AcsAPI_tab/AcsAPI = ('Public', 'Public Restricted')
)
]
"/>
<!-- exclude original_2 Piction images from Public API -->
<xsl:template mode="public" match="doc/dataSource[@name='original_2']"/>
<!-- TODO: what about AdmPublishWebNoPassword? -->
<!-- 1265 say "Yes", 555 say "No" -->
<!--
ObjObjectsRef_tab (optional)
sequence of ObjObjectsRef,
irn (string),
AdmPublishWebNoPassword,
AcsAPI_tab
sequence of AcsAPI (string)
-->
<!-- exclude narrative banner images -->
<xsl:template mode="public" match="record/MulMultiMediaRef_tab"/>
<!-- remove all precise locations from Public API -->
<xsl:template mode="public" match="LocCurrentLocationRef"/>
<!-- exclude object inwards loan flag -->
<xsl:template mode="public" match="InwardLoan"/>
<xsl:variable name="open-rights" select="
(
'Public Domain',
'Creative Commons Commercial Use',
'Creative Commons Non-Commercial Use'
)
"/>
<!-- remove all images if licence is not open -->
<xsl:template mode="public" match="record[not(AcsCCStatus = $open-rights)]/WebMultiMediaRef_tab"/>
<!-- remove rights data altogether if restricted; this will cause all images (including Piction images) to be redacted -->
<xsl:template mode="public" match="record/AcsCCStatus[not(. = $open-rights)]"/>
<!-- Exclude any narrative whose intended audience does not include "Collection Explorer publish" -->
<xsl:template mode="public" match="
record[
DesIntendedAudience_tab
]
[
not(
DesIntendedAudience_tab/DesIntendedAudience='Collection Explorer publish'
)
]
">
<xsl:copy/><!-- copies an empty <record> root element which will then be ignored -->
</xsl:template>
</xsl:stylesheet>