Index: DCWoRMS/trunk/src/test/DEBBTranslator/xml/DCWoRMSDEBBUpdater.xsl
===================================================================
--- DCWoRMS/trunk/src/test/DEBBTranslator/xml/DCWoRMSDEBBUpdater.xsl	(revision 889)
+++ DCWoRMS/trunk/src/test/DEBBTranslator/xml/DCWoRMSDEBBUpdater.xsl	(revision 890)
@@ -48,12 +48,12 @@
 				<xsl:attribute name="class">Cluster</xsl:attribute>
 				<xsl:attribute name="name">cluster</xsl:attribute>
-				<!-- In first version, for simplicity, we assume we have only
-				 one scheduler and one scheduling plugin. If $additionalInformationFileName
-				 contains more than one, the rest is ignored -->
+				<!-- In first version, for simplicity, we assume we have only one scheduler 
+					and one scheduling plugin. If $additionalInformationFileName contains more 
+					than one, the rest is ignored -->
 				<xsl:apply-templates select="$nestedDoc//schedulingPlugin[1]" />
 			</xsl:element>
 		</xsl:copy>
 	</xsl:template>
-	
+
 	<xsl:template match="timeEstimationPlugin">
 		<xsl:element name="timeEstimationPlugin">
@@ -63,14 +63,15 @@
 		</xsl:element>
 	</xsl:template>
-	
+
 
 	<xsl:template match="schedulingPlugin">
+		<xsl:variable name="pluginName" select="name" />
 		<xsl:element name="schedulingPlugin">
 			<xsl:element name="name">
-				<xsl:value-of select="name" />
+				<xsl:value-of select="$pluginName" />
 			</xsl:element>
 			<xsl:if test="frequency != ''">
 				<xsl:element name="frequency">
-					<xsl:value-of select="frequency"/>
+					<xsl:value-of select="frequency" />
 				</xsl:element>
 			</xsl:if>
@@ -79,29 +80,59 @@
 			<!-- TODO: This parameter should be taken from somewhere. -->
 			<xsl:attribute name="include">false</xsl:attribute>
+
+			<!-- Find appropriate resources (identified by class, type and name(s)) 
+				and add their names here -->
+			<xsl:variable name="resourceClass">
+				<xsl:value-of select="resources/class" />
+			</xsl:variable>
+			<!-- <xsl:value-of select="$resourceClass"/> -->
+			<xsl:variable name="resourceType">
+				<xsl:value-of select="resources/type" />
+			</xsl:variable>
+			<!-- <xsl:value-of select="$resourceType"/> -->
 			
-			<!-- Find appropriate resources (identified by class, type and name(s)) and add their names here -->
-			<xsl:variable name="resourceClass"><xsl:value-of select="resources/class"/></xsl:variable>
-<!--			<xsl:value-of select="$resourceClass"/>-->
-			<xsl:variable name="resourceType"><xsl:value-of select="resources/type"/></xsl:variable>
-<!--			<xsl:value-of select="$resourceType"/>-->
-			<xsl:variable name="resourceNames"><xsl:value-of select="resources/name"/></xsl:variable>
-			<xsl:variable name="xpath">$rootDoc//computingResource[@class=<xsl:value-of select="$resourceClass"/> and @type=<xsl:value-of select="$resourceType"/>]</xsl:variable>
-<!--			<xsl:value-of select="$xpath"></xsl:value-of>-->
-
-			<!-- TODO: Names are ignored now, for simplicity. Should be changed! -->
+			<!-- Not clear why it does not work this way :/ -->
+			<!-- <xsl:variable name="resourceNames"><xsl:value-of select="resources/name"/></xsl:variable> -->
+			<xsl:variable name="resourceNames"
+				select="$nestedDoc//schedulingPlugin[name=$pluginName]/resources/name" />
+
 			<xsl:choose>
-				<xsl:when test="$resourceClass != '' and $resourceType != ''">
-<!--					<xsl:value-of select="$resourceClass"/>-->
-<!--					<xsl:value-of select="$resourceType"/>-->
-					<xsl:apply-templates select="$rootDoc//computingResource[@class=$resourceClass and @type=$resourceType]" mode="addResorceName"/>
+				<!-- Resource names are present -->
+				<xsl:when test="count($resourceNames) > 0">
+					<xsl:for-each select="$resourceNames">
+						<xsl:variable name="index" select="position()" />
+						<xsl:variable name="resourceName" select="." />
+						<xsl:choose>
+							<!-- Resource type is present -->
+							<xsl:when test="$resourceType != ''">
+								<xsl:apply-templates
+									select="$rootDoc//computingResource[@class=$resourceClass and @type=$resourceType and @name=$resourceName]"
+									mode="addResorceName" />
+							</xsl:when>
+							<xsl:otherwise>
+								<xsl:apply-templates
+									select="$rootDoc//computingResource[@class=$resourceClass and @name=$resourceName]"
+									mode="addResorceName" />
+							</xsl:otherwise>
+						</xsl:choose>
+					</xsl:for-each>
 				</xsl:when>
+				<!-- No resource names -->
 				<xsl:otherwise>
-<!--					<xsl:value-of select="$resourceClass"/>-->
-					<xsl:apply-templates select="$rootDoc//computingResource[@class=$resourceClass]" mode="addResorceName"/>
+					<xsl:choose>
+						<!-- Resource type is present -->
+						<xsl:when test="$resourceType != ''">
+							<xsl:apply-templates
+								select="$rootDoc//computingResource[@class=$resourceClass and @type=$resourceType]"
+								mode="addResorceName" />
+						</xsl:when>
+						<xsl:otherwise>
+							<xsl:apply-templates
+								select="$rootDoc//computingResource[@class=$resourceClass]"
+								mode="addResorceName" />
+						</xsl:otherwise>
+					</xsl:choose>
 				</xsl:otherwise>
 			</xsl:choose>
-			
-			
-			
 		</xsl:element>
 	</xsl:template>
@@ -114,5 +145,5 @@
 		</xsl:element>
 	</xsl:template>
-	
+
 	<xsl:template match="computingResource">
 		<xsl:copy copy-namespaces="no">
@@ -124,5 +155,5 @@
 			<xsl:apply-templates select="parameter" />
 			<!-- profile -->
-			<xsl:apply-templates select="profile" />		
+			<xsl:apply-templates select="profile" />
 			<!-- location -->
 			<xsl:apply-templates select="location" />
@@ -134,17 +165,11 @@
 	<xsl:template match="computingResource" mode="addResorceName">
 		<xsl:element name="resourceName">
-			<xsl:value-of select="../@name"></xsl:value-of>
-		</xsl:element>
-	</xsl:template><!--
-	
-	<xsl:template match="powerProfile" mode="addEstimationPlugin">
-		<xsl:element name="energyEstimationPlugin">
-			<xsl:element name="name">
-				<xsl:value-of select="name" />
-			</xsl:element>
-		</xsl:element>	
-	</xsl:template>	
-	
-	--><xsl:template match="resourceUnit | parameter | location">
+			<!-- <xsl:value-of select="../@name"></xsl:value-of> -->
+			<xsl:value-of select="@name"></xsl:value-of>
+		</xsl:element>
+	</xsl:template><!-- <xsl:template match="powerProfile" mode="addEstimationPlugin"> 
+		<xsl:element name="energyEstimationPlugin"> <xsl:element name="name"> <xsl:value-of 
+		select="name" /> </xsl:element> </xsl:element> </xsl:template> -->
+	<xsl:template match="resourceUnit | parameter | location">
 		<xsl:copy-of select="." copy-namespaces="no" />
 	</xsl:template>
@@ -154,33 +179,39 @@
 			<xsl:copy-of select="@*" />
 			<xsl:apply-templates select="powerProfile" />
-		</xsl:copy>					
-	</xsl:template>
-
-	<xsl:template match="powerProfile">	
+		</xsl:copy>
+	</xsl:template>
+
+	<xsl:template match="powerProfile">
 		<xsl:copy copy-namespaces="no">
 			<xsl:variable name="resourceClass" select="../../@class"></xsl:variable>
 			<xsl:variable name="resourceType" select="../../@type"></xsl:variable>
 			<xsl:variable name="resourceName" select="../../@name"></xsl:variable>
-			
+
 			<xsl:choose>
 				<xsl:when test="$resourceType != ''">
 					<!-- resource class and type -->
 					<!-- Add information about energy estimation plugin -->
-					<xsl:apply-templates select="$nestedDoc//energyEstimationPlugin[resources/class = $resourceClass and resources/type = $resourceType]"/>					
+					<xsl:apply-templates
+						select="$nestedDoc//energyEstimationPlugin[resources/class = $resourceClass and resources/type = $resourceType]" />
 				</xsl:when>
 				<xsl:otherwise>
 					<!-- resource class only -->
 					<!-- Add information about energy estimation plugin -->
-					<xsl:apply-templates select="$nestedDoc//energyEstimationPlugin[resources/class = $resourceClass]"/>					
+					<xsl:apply-templates
+						select="$nestedDoc//energyEstimationPlugin[resources/class = $resourceClass]" />
 				</xsl:otherwise>
 			</xsl:choose>
 			<!-- Copy all children of powerProfile -->
-			<xsl:copy-of select="@*|node()" />		
-		</xsl:copy>	
-		
-	</xsl:template>	
-	
-	 <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*"/> 
-		<xsl:apply-templates/> </xsl:copy> </xsl:template> 
+			<xsl:copy-of select="@*|node()" />
+		</xsl:copy>
+
+	</xsl:template>
+
+	<xsl:template match="@*|node()">
+		<xsl:copy>
+			<xsl:apply-templates select="@*" />
+			<xsl:apply-templates />
+		</xsl:copy>
+	</xsl:template>
 
 </xsl:stylesheet>
