1 | <?xml version="1.0" encoding="utf-8"?> |
---|
2 | <xsl:stylesheet |
---|
3 | version="2.0" |
---|
4 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
5 | xmlns:dcr="http://www.isocat.org/ns/dcr.rdf#" |
---|
6 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
7 | xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
---|
8 | xmlns:dcif="http://www.isocat.org/ns/dcif" |
---|
9 | exclude-result-prefixes="dcr rdf rdfs" |
---|
10 | > |
---|
11 | <!-- |
---|
12 | <purpose> |
---|
13 | handle all rdf DCRs (currently isocat, dublincore elements and terms) |
---|
14 | </purpose> |
---|
15 | <strategy>map from rdf to Terms </strategy> |
---|
16 | <params> |
---|
17 | <param name=""></param> |
---|
18 | </params> |
---|
19 | <history> |
---|
20 | <change on="2010-10-10" type="created" by="vr"></change> |
---|
21 | <change on="2011-10-26" type="changed" by="vr">reworking for SMC</change> |
---|
22 | </history> |
---|
23 | --> |
---|
24 | |
---|
25 | <!--<xsl:output method="xml" indent="yes" > </xsl:output>--> |
---|
26 | |
---|
27 | <!-- <xsl:param name="isocat_prefix" select="'http://www.isocat.org/datcat/'"></xsl:param>--> |
---|
28 | |
---|
29 | <!-- |
---|
30 | decide based on the inner-structure, what it is and how to handle |
---|
31 | --> |
---|
32 | <xsl:template match="*" mode="dcr"> |
---|
33 | <xsl:param name="config-node" /> |
---|
34 | <xsl:param name="set" /> |
---|
35 | |
---|
36 | <Termset set="{$set}" name="{$config-node/name}" url="{$config-node/url_prefix}" > |
---|
37 | <xsl:apply-templates select="/rdf:RDF/rdf:Description | /rdf:RDF/rdf:Property | /dcif:dataCategorySelection/dcif:dataCategory "> |
---|
38 | <xsl:with-param name="set" select="$set" /> |
---|
39 | </xsl:apply-templates> |
---|
40 | </Termset> |
---|
41 | </xsl:template> |
---|
42 | |
---|
43 | <xsl:template match="*" mode="rr"> |
---|
44 | <xsl:param name="set" /> |
---|
45 | |
---|
46 | <Termset set="{$set}"> |
---|
47 | <xsl:apply-templates select="/rdf:RDF/rdf:Description" mode="rr"> |
---|
48 | <xsl:with-param name="set" select="$set" /> |
---|
49 | </xsl:apply-templates> |
---|
50 | </Termset> |
---|
51 | </xsl:template> |
---|
52 | |
---|
53 | |
---|
54 | <!-- isocat.rdf --> |
---|
55 | <xsl:template match="rdf:Description[@rdf:ID]" > |
---|
56 | <xsl:param name="set" /> |
---|
57 | |
---|
58 | <Concept type="datcat" id="{dcr:datcat}"> |
---|
59 | <Term set="{$set}" type="mnemonic" > |
---|
60 | <xsl:value-of select="@rdf:ID" /> |
---|
61 | </Term> |
---|
62 | <Term set="{$set}" type="id" > |
---|
63 | <xsl:value-of select="substring-after(dcr:datcat,$isocat_prefix)" /> |
---|
64 | </Term> |
---|
65 | <xsl:for-each select="rdfs:label" > |
---|
66 | <Term set="{$set}" type="label" xml:lang="{./@xml:lang}"> |
---|
67 | <xsl:value-of select="." /> |
---|
68 | </Term> |
---|
69 | </xsl:for-each> |
---|
70 | <xsl:for-each select="rdfs:comment" > |
---|
71 | <info> |
---|
72 | <xsl:copy-of select="./@xml:lang"/> |
---|
73 | <xsl:value-of select="." /> |
---|
74 | </info> |
---|
75 | </xsl:for-each> |
---|
76 | <!-- <xsl:copy-of select="rdfs:comment|rdfs:label"></xsl:copy-of>--> |
---|
77 | </Concept> |
---|
78 | </xsl:template> |
---|
79 | |
---|
80 | <!-- dublincore elements | terms --> |
---|
81 | <xsl:template match="rdf:Property|rdf:Description[@rdf:about]" > |
---|
82 | <xsl:param name="set" /> |
---|
83 | <Concept type="datcat" id="{@rdf:about}"> |
---|
84 | <Term set="{$set}" type="label" > |
---|
85 | <xsl:value-of select="rdfs:label" /><!-- discard the xml:lang-attribute of rdfs:label (en-US) --> |
---|
86 | </Term> |
---|
87 | <xsl:for-each select="rdfs:comment" > |
---|
88 | <info> |
---|
89 | <xsl:copy-of select="./@xml:lang"/> |
---|
90 | <xsl:value-of select="." /> |
---|
91 | </info> |
---|
92 | </xsl:for-each> |
---|
93 | </Concept> |
---|
94 | </xsl:template> |
---|
95 | |
---|
96 | <!-- process relations from RR --> |
---|
97 | <xsl:template match="rdf:Description" mode="rr"> |
---|
98 | <xsl:param name="set" /> |
---|
99 | <xsl:variable name="reltype" select= "*/name()" /> |
---|
100 | <Relation type="{$reltype}" > |
---|
101 | <Concept type="datcat" id="{@rdf:about}" role="about"></Concept> |
---|
102 | <Concept type="datcat" id="{*/@rdf:resource}" ></Concept> |
---|
103 | </Relation> |
---|
104 | </xsl:template> |
---|
105 | </xsl:stylesheet> |
---|