- Timestamp:
- 02/27/13 13:07:49 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/test/DEBBTranslator/xml/DCWoRMSDEBBUpdater.xsl
r889 r890 48 48 <xsl:attribute name="class">Cluster</xsl:attribute> 49 49 <xsl:attribute name="name">cluster</xsl:attribute> 50 <!-- In first version, for simplicity, we assume we have only 51 one scheduler and one scheduling plugin. If $additionalInformationFileName52 contains morethan one, the rest is ignored -->50 <!-- In first version, for simplicity, we assume we have only one scheduler 51 and one scheduling plugin. If $additionalInformationFileName contains more 52 than one, the rest is ignored --> 53 53 <xsl:apply-templates select="$nestedDoc//schedulingPlugin[1]" /> 54 54 </xsl:element> 55 55 </xsl:copy> 56 56 </xsl:template> 57 57 58 58 <xsl:template match="timeEstimationPlugin"> 59 59 <xsl:element name="timeEstimationPlugin"> … … 63 63 </xsl:element> 64 64 </xsl:template> 65 65 66 66 67 67 <xsl:template match="schedulingPlugin"> 68 <xsl:variable name="pluginName" select="name" /> 68 69 <xsl:element name="schedulingPlugin"> 69 70 <xsl:element name="name"> 70 <xsl:value-of select=" name" />71 <xsl:value-of select="$pluginName" /> 71 72 </xsl:element> 72 73 <xsl:if test="frequency != ''"> 73 74 <xsl:element name="frequency"> 74 <xsl:value-of select="frequency" />75 <xsl:value-of select="frequency" /> 75 76 </xsl:element> 76 77 </xsl:if> … … 79 80 <!-- TODO: This parameter should be taken from somewhere. --> 80 81 <xsl:attribute name="include">false</xsl:attribute> 82 83 <!-- Find appropriate resources (identified by class, type and name(s)) 84 and add their names here --> 85 <xsl:variable name="resourceClass"> 86 <xsl:value-of select="resources/class" /> 87 </xsl:variable> 88 <!-- <xsl:value-of select="$resourceClass"/> --> 89 <xsl:variable name="resourceType"> 90 <xsl:value-of select="resources/type" /> 91 </xsl:variable> 92 <!-- <xsl:value-of select="$resourceType"/> --> 81 93 82 <!-- Find appropriate resources (identified by class, type and name(s)) and add their names here --> 83 <xsl:variable name="resourceClass"><xsl:value-of select="resources/class"/></xsl:variable> 84 <!-- <xsl:value-of select="$resourceClass"/>--> 85 <xsl:variable name="resourceType"><xsl:value-of select="resources/type"/></xsl:variable> 86 <!-- <xsl:value-of select="$resourceType"/>--> 87 <xsl:variable name="resourceNames"><xsl:value-of select="resources/name"/></xsl:variable> 88 <xsl:variable name="xpath">$rootDoc//computingResource[@class=<xsl:value-of select="$resourceClass"/> and @type=<xsl:value-of select="$resourceType"/>]</xsl:variable> 89 <!-- <xsl:value-of select="$xpath"></xsl:value-of>--> 90 91 <!-- TODO: Names are ignored now, for simplicity. Should be changed! --> 94 <!-- Not clear why it does not work this way :/ --> 95 <!-- <xsl:variable name="resourceNames"><xsl:value-of select="resources/name"/></xsl:variable> --> 96 <xsl:variable name="resourceNames" 97 select="$nestedDoc//schedulingPlugin[name=$pluginName]/resources/name" /> 98 92 99 <xsl:choose> 93 <xsl:when test="$resourceClass != '' and $resourceType != ''"> 94 <!-- <xsl:value-of select="$resourceClass"/>--> 95 <!-- <xsl:value-of select="$resourceType"/>--> 96 <xsl:apply-templates select="$rootDoc//computingResource[@class=$resourceClass and @type=$resourceType]" mode="addResorceName"/> 100 <!-- Resource names are present --> 101 <xsl:when test="count($resourceNames) > 0"> 102 <xsl:for-each select="$resourceNames"> 103 <xsl:variable name="index" select="position()" /> 104 <xsl:variable name="resourceName" select="." /> 105 <xsl:choose> 106 <!-- Resource type is present --> 107 <xsl:when test="$resourceType != ''"> 108 <xsl:apply-templates 109 select="$rootDoc//computingResource[@class=$resourceClass and @type=$resourceType and @name=$resourceName]" 110 mode="addResorceName" /> 111 </xsl:when> 112 <xsl:otherwise> 113 <xsl:apply-templates 114 select="$rootDoc//computingResource[@class=$resourceClass and @name=$resourceName]" 115 mode="addResorceName" /> 116 </xsl:otherwise> 117 </xsl:choose> 118 </xsl:for-each> 97 119 </xsl:when> 120 <!-- No resource names --> 98 121 <xsl:otherwise> 99 <!-- <xsl:value-of select="$resourceClass"/>--> 100 <xsl:apply-templates select="$rootDoc//computingResource[@class=$resourceClass]" mode="addResorceName"/> 122 <xsl:choose> 123 <!-- Resource type is present --> 124 <xsl:when test="$resourceType != ''"> 125 <xsl:apply-templates 126 select="$rootDoc//computingResource[@class=$resourceClass and @type=$resourceType]" 127 mode="addResorceName" /> 128 </xsl:when> 129 <xsl:otherwise> 130 <xsl:apply-templates 131 select="$rootDoc//computingResource[@class=$resourceClass]" 132 mode="addResorceName" /> 133 </xsl:otherwise> 134 </xsl:choose> 101 135 </xsl:otherwise> 102 136 </xsl:choose> 103 104 105 106 137 </xsl:element> 107 138 </xsl:template> … … 114 145 </xsl:element> 115 146 </xsl:template> 116 147 117 148 <xsl:template match="computingResource"> 118 149 <xsl:copy copy-namespaces="no"> … … 124 155 <xsl:apply-templates select="parameter" /> 125 156 <!-- profile --> 126 <xsl:apply-templates select="profile" /> 157 <xsl:apply-templates select="profile" /> 127 158 <!-- location --> 128 159 <xsl:apply-templates select="location" /> … … 134 165 <xsl:template match="computingResource" mode="addResorceName"> 135 166 <xsl:element name="resourceName"> 136 <xsl:value-of select="../@name"></xsl:value-of> 137 </xsl:element> 138 </xsl:template><!-- 139 140 <xsl:template match="powerProfile" mode="addEstimationPlugin"> 141 <xsl:element name="energyEstimationPlugin"> 142 <xsl:element name="name"> 143 <xsl:value-of select="name" /> 144 </xsl:element> 145 </xsl:element> 146 </xsl:template> 147 148 --><xsl:template match="resourceUnit | parameter | location"> 167 <!-- <xsl:value-of select="../@name"></xsl:value-of> --> 168 <xsl:value-of select="@name"></xsl:value-of> 169 </xsl:element> 170 </xsl:template><!-- <xsl:template match="powerProfile" mode="addEstimationPlugin"> 171 <xsl:element name="energyEstimationPlugin"> <xsl:element name="name"> <xsl:value-of 172 select="name" /> </xsl:element> </xsl:element> </xsl:template> --> 173 <xsl:template match="resourceUnit | parameter | location"> 149 174 <xsl:copy-of select="." copy-namespaces="no" /> 150 175 </xsl:template> … … 154 179 <xsl:copy-of select="@*" /> 155 180 <xsl:apply-templates select="powerProfile" /> 156 </xsl:copy> 157 </xsl:template> 158 159 <xsl:template match="powerProfile"> 181 </xsl:copy> 182 </xsl:template> 183 184 <xsl:template match="powerProfile"> 160 185 <xsl:copy copy-namespaces="no"> 161 186 <xsl:variable name="resourceClass" select="../../@class"></xsl:variable> 162 187 <xsl:variable name="resourceType" select="../../@type"></xsl:variable> 163 188 <xsl:variable name="resourceName" select="../../@name"></xsl:variable> 164 189 165 190 <xsl:choose> 166 191 <xsl:when test="$resourceType != ''"> 167 192 <!-- resource class and type --> 168 193 <!-- Add information about energy estimation plugin --> 169 <xsl:apply-templates select="$nestedDoc//energyEstimationPlugin[resources/class = $resourceClass and resources/type = $resourceType]"/> 194 <xsl:apply-templates 195 select="$nestedDoc//energyEstimationPlugin[resources/class = $resourceClass and resources/type = $resourceType]" /> 170 196 </xsl:when> 171 197 <xsl:otherwise> 172 198 <!-- resource class only --> 173 199 <!-- Add information about energy estimation plugin --> 174 <xsl:apply-templates select="$nestedDoc//energyEstimationPlugin[resources/class = $resourceClass]"/> 200 <xsl:apply-templates 201 select="$nestedDoc//energyEstimationPlugin[resources/class = $resourceClass]" /> 175 202 </xsl:otherwise> 176 203 </xsl:choose> 177 204 <!-- Copy all children of powerProfile --> 178 <xsl:copy-of select="@*|node()" /> 179 </xsl:copy> 180 181 </xsl:template> 182 183 <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*"/> 184 <xsl:apply-templates/> </xsl:copy> </xsl:template> 205 <xsl:copy-of select="@*|node()" /> 206 </xsl:copy> 207 208 </xsl:template> 209 210 <xsl:template match="@*|node()"> 211 <xsl:copy> 212 <xsl:apply-templates select="@*" /> 213 <xsl:apply-templates /> 214 </xsl:copy> 215 </xsl:template> 185 216 186 217 </xsl:stylesheet>
Note: See TracChangeset
for help on using the changeset viewer.