1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <!DOCTYPE rdf:RDF [ |
---|
3 | <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> |
---|
4 | <!ENTITY rdfs 'http://www.w3.org/TR/WD-rdf-schema#'> |
---|
5 | <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> |
---|
6 | <!ENTITY cmdm 'http://www.clarin.eu/cmd/general.rdf#'> |
---|
7 | <!ENTITY oa 'http://www.w3.org/ns/oa#'> |
---|
8 | ]> |
---|
9 | <xsl:stylesheet |
---|
10 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" |
---|
11 | xmlns:dcr="http://www.isocat.org/ns/dcr.rdf#" |
---|
12 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
13 | xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
---|
14 | xmlns:cmd="http://www.clarin.eu/cmd/" |
---|
15 | xmlns:cmdm="http://www.clarin.eu/cmd/general.rdf#" |
---|
16 | xmlns:ore="http://www.openarchives.org/ore/terms/" |
---|
17 | xmlns:oa="http://www.w3.org/ns/oa#" |
---|
18 | xmlns:dcterms="http://purl.org/dc/terms/" |
---|
19 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
20 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
---|
21 | > |
---|
22 | |
---|
23 | <xsl:import href="CMDRecord2RDF.xsl"/> |
---|
24 | |
---|
25 | <xsl:output method="xml" encoding="UTF-8"/> |
---|
26 | |
---|
27 | <xsl:param name="base" select="base-uri()"/> |
---|
28 | |
---|
29 | <xsl:include href="CMD2RDFcache.xsl"/> |
---|
30 | |
---|
31 | |
---|
32 | <xsl:template match="/cmd:CMD/cmd:Components"> |
---|
33 | <!-- get the profile id --> |
---|
34 | <!-- get the profile id --> |
---|
35 | <xsl:variable name="id"> |
---|
36 | <xsl:choose> |
---|
37 | <xsl:when test="exists(/cmd:CMD/cmd:Header/cmd:MdProfile)"> |
---|
38 | <!-- and ignore if there are multiple MdProfile and just take the first!! |
---|
39 | although probably this more a case for the schema validation! --> |
---|
40 | <xsl:sequence select="cmd:id((/cmd:CMD/cmd:Header/cmd:MdProfile)[1])"/> |
---|
41 | </xsl:when> |
---|
42 | <xsl:when test="exists(/cmd:CMD/@xsi:schemaLocation)"> |
---|
43 | <xsl:sequence select="cmd:id(/cmd:CMD/@xsi:schemaLocation)"/> |
---|
44 | </xsl:when> |
---|
45 | <xsl:otherwise> |
---|
46 | <xsl:message terminate="yes"> |
---|
47 | <xsl:text>ERR: the CMDI record doesn't refer to its profile!</xsl:text> |
---|
48 | </xsl:message> |
---|
49 | </xsl:otherwise> |
---|
50 | </xsl:choose> |
---|
51 | </xsl:variable> |
---|
52 | <if test="not(startsWith($id,'clarin.eu:'))"> |
---|
53 | <xsl:text>ERR: the CMDI record doesn't refer to a profile in the CR!</xsl:text> |
---|
54 | </if> |
---|
55 | <!-- prefetch the profile into the cache on the fly. |
---|
56 | the profile (if freshly fetched) will however only be available in subsequent calls |
---|
57 | one can't write to output, while in temporary tree (e.g. xsl:variable, or a function), |
---|
58 | therefore this has to be called separately in the main sequence |
---|
59 | this call does not return any data --> |
---|
60 | <xsl:call-template name="cmd:cache-profile"> |
---|
61 | <xsl:with-param name="id" select="$id"></xsl:with-param> |
---|
62 | </xsl:call-template> |
---|
63 | <!-- load the profile --> |
---|
64 | <xsl:variable name="profile" select="cmd:profile($id)"/> |
---|
65 | <!-- the base URL (the namespace in RDF/XML) of the RDF resources will change during traversal to the URL of the active profile/component --> |
---|
66 | <xsl:variable name="ns" select="concat(cmd:ppath($id,'rdf'),'#')"/> |
---|
67 | <!-- we traverse the profile/component scheme and find the matching instances --> |
---|
68 | <xsl:apply-templates select="$profile/CMD_ComponentSpec/CMD_Component"> |
---|
69 | <xsl:with-param name="context" tunnel="yes" select="''"/> |
---|
70 | <xsl:with-param name="ns" tunnel="yes" select="$ns"/> |
---|
71 | <xsl:with-param name="instance" tunnel="yes" select="."/> |
---|
72 | </xsl:apply-templates> |
---|
73 | </xsl:template> |
---|
74 | |
---|
75 | |
---|
76 | </xsl:stylesheet> |
---|