Changeset 2235 for SMC/trunk/SMC/src/scripts/smc_commons.xsl
- Timestamp:
- 09/19/12 10:36:16 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SMC/trunk/SMC/src/scripts/smc_commons.xsl
r1876 r2235 7 7 <xsl:include href="cmd_includes.xsl"/> 8 8 <xsl:include href="dcr_rdf2terms.xsl"/> 9 <xsl:include href="dcr_dcif2terms.xsl"/> 9 10 10 11 <!-- use either input (precedence) or the config-file as the termsets configuration --> … … 26 27 <!-- intermediate datasets bound into variables,to prevent calling the function every time --> 27 28 <xsl:variable name="dcr-terms" select="my:getData('dcr-terms')" /> 29 <xsl:variable name="rr-relations" select="my:getData('rr-relations')" /> 30 <!-- rr-relations expanded with terms--> 31 <xsl:variable name="rr-terms" select="my:getData('rr-terms')" /> 28 32 <xsl:variable name="cmd-terms" select="my:getData('cmd-terms')" /> 33 <xsl:variable name="cmd-terms-nested" select="my:getData('cmd-terms-nested')" /> 29 34 <xsl:variable name="dcr-cmd-map" select="my:getData('dcr-cmd-map')" /> 30 35 <xsl:variable name="isocat-languages" select="my:getData('isocat-languages')" /> … … 41 46 <xsl:variable name="cached_data_file" select="concat($cache_dir, $key, '.xml')"></xsl:variable> 42 47 <xsl:message> 43 cache: <xsl:value-of select="$cache" /> 48 cache: <xsl:value-of select="$cache" /> - 44 49 <xsl:value-of select="$cached_data_file" />: <xsl:value-of select="doc-available($cached_data_file)" /> 45 50 </xsl:message> … … 48 53 <xsl:message>reading in: <xsl:value-of select="$cached_data_file" /> 49 54 </xsl:message> 50 <xsl:copy-of select="doc ument($cached_data_file)"></xsl:copy-of>55 <xsl:copy-of select="doc($cached_data_file)"></xsl:copy-of> 51 56 </xsl:when> 52 57 <xsl:when test="$key='cmd-profiles-raw'"> … … 57 62 </xsl:when> 58 63 <xsl:when test="$key='cmd-terms'"> 59 <xsl:copy-of select="my:profiles2termsets(my:getData('cmd-resolved')//profileDescription)" /> 60 </xsl:when> 64 <xsl:copy-of select="my:profiles2termsets(my:getData('cmd-resolved')//profileDescription,false())" /> 65 </xsl:when> 66 <xsl:when test="$key='cmd-terms-nested'"> 67 <xsl:copy-of select="my:profiles2termsets(my:getData('cmd-resolved')//profileDescription,true())" /> 68 </xsl:when> 69 <xsl:when test="$key='cmd-terms-nested-minimal'"> 70 <xsl:apply-templates select="$cmd-terms-nested" mode="min-context"></xsl:apply-templates> 71 </xsl:when> 61 72 <xsl:when test="$key='dcr-terms'"> 62 73 <xsl:call-template name="load-dcr" /> 63 74 </xsl:when> 75 <xsl:when test="$key='rr-relations'"> 76 <xsl:call-template name="load-rr-relations" /> 77 </xsl:when> 78 <xsl:when test="$key='rr-terms'"> 79 <xsl:call-template name="rr-terms" /> 80 </xsl:when> 64 81 <xsl:when test="$key='termsets'"> 65 82 <xsl:call-template name="termsets" /> … … 94 111 <xsl:variable name="dcr_termset" select="document(url)" /> 95 112 <xsl:apply-templates select="$dcr_termset" mode="dcr" > 113 <xsl:with-param name="config-node" select="."></xsl:with-param> 96 114 <xsl:with-param name="set" select="key"></xsl:with-param> 97 115 </xsl:apply-templates> … … 100 118 </xsl:template> 101 119 120 102 121 <!-- invert the profiles-termsets + match with data from DCRs = create map datcat -> cmd-elements[] --> 103 122 <xsl:template name="dcr-cmd-map"> … … 105 124 <xsl:for-each-group select="$cmd-terms//Term[not(@datcat='')]" group-by="@datcat"> 106 125 <Concept id="{@datcat}" type="datcat"> 107 <xsl:copy-of select="$dcr-terms//Concept[@id=current()/@datcat]/Term" />126 <xsl:copy-of select="$dcr-terms//Concept[@id=current()/@datcat]/Term" exclude-result-prefixes="my" /> 108 127 <xsl:for-each select="current-group()"> 109 128 <xsl:variable name="parent_profile" select="ancestor::Termset[@type='CMD_Profile']/@id" /> … … 154 173 </xsl:template> 155 174 175 <!-- load relation sets from the configuration and transform into Termset/Relation/Concepet 176 (uses mode=rr-templates in dcr_rdf2terms.xsl) --> 177 <xsl:template name="load-rr-relations"> 178 <Termsets type="rr"> 179 <xsl:for-each select="$termsets_config//*[type='rr']" > 180 <xsl:variable name="rr_termset" select="document(url)" /> 181 <xsl:apply-templates select="$rr_termset" mode="rr" > 182 <xsl:with-param name="set" select="key"></xsl:with-param> 183 </xsl:apply-templates> 184 </xsl:for-each> 185 </Termsets> 186 </xsl:template> 187 188 <!-- take the rr-relations and expand them with data from dcr-cmd-terms, 189 to get rr-expanded terms --> 190 <xsl:template name="rr-terms"> 191 <xsl:apply-templates select="$rr-relations" mode="rr-expand" ></xsl:apply-templates> 192 </xsl:template> 193 194 <xsl:template match="*" mode="rr-expand"> 195 <xsl:copy> 196 <xsl:copy-of select="@*" /> 197 <xsl:apply-templates mode="rr-expand"></xsl:apply-templates> 198 </xsl:copy> 199 </xsl:template> 200 <!-- expand rr-concepts--> 201 <xsl:template match="Concept" mode="rr-expand"> 202 <xsl:variable name="concept-id" select="@id" /> 203 <xsl:copy> 204 <xsl:copy-of select="@*" /> 205 <xsl:copy-of select="$dcr-cmd-map//Concept[@id=$concept-id]/Term" /> 206 </xsl:copy> 207 </xsl:template> 208 156 209 <!-- return a property of a Termset from the configuration. --> 157 210 <xsl:function name="my:config"> … … 160 213 <xsl:value-of select="$termsets_config//*[key=$key]/*[name()=$property]"></xsl:value-of> 161 214 </xsl:function> 215 216 162 217 </xsl:stylesheet>
Note: See TracChangeset
for help on using the changeset viewer.