This repository was archived by the owner on Jun 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 601
/
Copy pathPOD_v1_1.xsl
131 lines (106 loc) · 3.95 KB
/
POD_v1_1.xsl
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
121
122
123
124
125
126
127
128
129
130
131
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output encoding="UTF-8" method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="catalog">
{
<xsl:apply-templates select="type | context | id" />
<xsl:apply-templates select="conformsTo | describedBy"/>
"dataset":[
<xsl:apply-templates select="dataset"/>
]
}
</xsl:template>
<xsl:template match="context | id">
"@<xsl:value-of select="local-name()"/>":"<xsl:value-of select="."/>",
</xsl:template>
<xsl:template match="type">
"@<xsl:value-of select="local-name()"/>":"<xsl:value-of select="."/>" <xsl:if test="position() != last()">,</xsl:if>
</xsl:template>
<xsl:template match="dataset">
{
<xsl:apply-templates/>
}<xsl:if test="position() != last()">,</xsl:if>
</xsl:template>
<xsl:template match="contactPoint">
"<xsl:value-of select="local-name()"/>":{
<xsl:apply-templates/>
},
</xsl:template>
<xsl:template match="hasEmail">
"<xsl:value-of select="local-name()"/>":"mailto:<xsl:value-of select="."/>"
</xsl:template>
<xsl:template match="keyword">
"<xsl:value-of select="local-name()"/>":[
<xsl:apply-templates/>
],
</xsl:template>
<xsl:template match="item">
"<xsl:value-of select="normalize-space(.)"/>" <xsl:if test="position() != last()">,</xsl:if>
</xsl:template>
<!-- <xsl:template match="keyword"/>-->
<xsl:template match="publisher">
"<xsl:value-of select="local-name()"/>":{
<xsl:apply-templates select="@* | *"/>
},
</xsl:template>
<xsl:template match="subOrganizationOf">
"<xsl:value-of select="local-name()"/>":{
<xsl:apply-templates select="@* | *"/>
}
</xsl:template>
<xsl:template match="bureauCode | programCode">
"<xsl:value-of select="local-name()"/>":[
"<xsl:value-of select="."/>"
],
</xsl:template>
<xsl:template match="dataQuality">
"<xsl:value-of select="local-name()"/>":<xsl:value-of select="."/>,
</xsl:template>
<xsl:template match="distribution[1]">
"<xsl:value-of select="local-name()"/>":[
{
<xsl:apply-templates select="@* | *"/>
}<xsl:if test="position() != last()">,</xsl:if>
<xsl:apply-templates select="following-sibling::distribution" mode="pull"/>
] <xsl:if test="following-sibling::*">,</xsl:if>
</xsl:template>
<xsl:template match="distribution" mode="pull">
{
<xsl:apply-templates select="@* | *"/>
}<xsl:if test="position() != last()">,</xsl:if>
<xsl:apply-templates select="following-sibling::distribution"/>
</xsl:template>
<xsl:template match="distribution"/>
<xsl:template match="language">
<xsl:if test="item[. != '']"> "<xsl:value-of select="local-name()"/>":[
<xsl:apply-templates/>
]<xsl:if test="following-sibling::*">,</xsl:if></xsl:if>
</xsl:template>
<xsl:template match="references">
"<xsl:value-of select="local-name()"/>":[
<xsl:apply-templates/>
]<xsl:if test="following-sibling::*">,</xsl:if>
</xsl:template>
<xsl:template match="url">
"<xsl:value-of select="."/>"<xsl:if test="position() != last()">,</xsl:if>
</xsl:template>
<xsl:template match="theme" >
<xsl:if test="item[. != '']">"<xsl:value-of select="local-name()"/>":[
<xsl:apply-templates/>
]<xsl:if test="following-sibling::*">,</xsl:if></xsl:if>
</xsl:template>
<xsl:template match="@*">
"@<xsl:value-of select="local-name()"/>":"<xsl:value-of select="."/>",<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="*">
<xsl:if test=". != ''"> "<xsl:value-of select="local-name()"/>":"<xsl:value-of select="normalize-space(.)"/>"<xsl:if test="following-sibling::*[. != '']">,</xsl:if>
<xsl:apply-templates select="*"/></xsl:if>
</xsl:template>
</xsl:stylesheet>