source: SMC/trunk/SMC/src/scripts/cmd_includes.xsl @ 1657

Last change on this file since 1657 was 1657, checked in by vronk, 12 years ago

minor changes for operation map

File size: 3.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8" ?>
2<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:my="myFunctions"
4 exclude-result-prefixes="my">
5
6<!--
7<purpose>CMD-components inclusion mechanism</purpose>
8<history>
9        <change on="2011-09-01" type="created" by="vr">extracted from cmd_commons.xsl</change>
10</history>
11
12-->
13
14    <!-- resolve includes -->
15    <xsl:template match="@*|node()" mode="include">
16        <xsl:copy>
17            <xsl:apply-templates select="@*|node()" mode="include"/>
18        </xsl:copy>
19    </xsl:template>
20
21    <xsl:template match="CMD_Component[@ComponentId]" mode="include">
22   
23                <!-- <xsl:param name="resolved_path" select="if (matches(@filename, $prefix)) then $prefix_replace else './'" /> -->
24
25                <!-- <xsl:variable name="resolved_fn" select="if (matches(@filename, $prefix)) then replace(@filename, $prefix, $prefix_replace) else if (document-uri(/)) then @filename else concat( $root_uri, '/', @filename)" /> -->               
26                <!--<xsl:variable name="resolved_fn" select="concat($cmd_components_uri, my:extractID(@ComponentId))" />-->   
27            <xsl:variable name="resolved_fn" select="concat($cmd_components_uri, @ComponentId)" /> 
28            <xsl:variable name="compid" select="@ComponentId" /> 
29               
30        <!-- <xsl:variable name="resolved_fn" select="replace(@filename, 'http://www.clarin.eu/cmd/components', 'file:///C:/Users/master/3lingua/clarin/CMDI/_repo2/metadata/toolkit/components')" /> -->
31       
32<!--        <xsl:message>document-uri:<xsl:value-of select="document-uri(/)" /></xsl:message>
33        <xsl:message>resolved_fn:<xsl:value-of select="$resolved_fn" /></xsl:message>       
34-->       
35        <!-- some of the outer CMD_Component attributes can overwrite the inner CMD_Component attributes -->       
36        <xsl:variable name="outer-attr" select="@CardinalityMin|@CardinalityMax"/>
37        <xsl:for-each select="document($resolved_fn)/CMD_ComponentSpec/CMD_Component">
38            <xsl:variable name="inner-attr" select="@*"/>
39            <xsl:copy>
40                        <!-- <xsl:attribute name="filename" select="replace($resolved_fn,$prefix_replace,'')" /> -->
41               
42                        <xsl:attribute name="ComponentId" select="$compid" />
43                <xsl:apply-templates select="$outer-attr" mode="include"/>
44                <xsl:apply-templates select="$inner-attr[not(node-name(.) = $outer-attr/node-name(.))]" mode="include"/>
45                <xsl:apply-templates select="node()" mode="include">
46        <!--            <xsl:with-param name="resolved_path" select="$resolved_path" /> -->
47                </xsl:apply-templates>
48            </xsl:copy>
49        </xsl:for-each>
50    </xsl:template>
51   
52
53    <xsl:template match="componentDescription[id] | profileDescription[id]" mode="include">
54   
55        <!--  <xsl:variable name="resolved_uri" select="concat($root_uri, '/', id)" />-->
56        <!--<xsl:variable name="resolved_uri" select="concat($cmd_profiles_uri , '/', my:extractID(id))" />-->
57        <xsl:variable name="resolved_uri" select="concat($cmd_profiles_uri , id)" />
58       
59        <xsl:message>PROFILE: document-uri:<xsl:value-of select="document-uri(/)" /></xsl:message>
60        <xsl:message>resolved_uri:<xsl:value-of select="$resolved_uri" /></xsl:message>
61       
62               
63        <xsl:copy>             
64                <xsl:apply-templates mode="include" />
65                <xsl:apply-templates select="document($resolved_uri)" mode="include" />
66                <!-- <xsl:copy-of select="document($resolved_uri)" /> -->
67                <!-- <xsl:copy-of select="document(id, $root_uri)" />  -->
68        </xsl:copy>
69    </xsl:template>
70
71</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.