Index: DCWoRMS/branches/coolemall/src/test/DEBBTranslator/xml/PLMXMLTranslator.xsl
===================================================================
--- DCWoRMS/branches/coolemall/src/test/DEBBTranslator/xml/PLMXMLTranslator.xsl	(revision 949)
+++ DCWoRMS/branches/coolemall/src/test/DEBBTranslator/xml/PLMXMLTranslator.xsl	(revision 950)
@@ -18,5 +18,5 @@
 
 	<!-- Information from which level the translator should start moving information to templates -->
-	<xsl:variable name="templateStartLevel" select="'Node'" />
+	<xsl:variable name="templateStartLevel" select="''" />
 
 	<!-- Specification of the output document -->
@@ -44,5 +44,6 @@
 			</xsl:element>
 			
-			<xsl:if test="fun:containsTemplates()">
+			<!-- Create templates (if needed) -->
+			<xsl:if test="fun:containsTemplates() = true()">
 				<xsl:element name="templates">
 					<!-- Iterate the document and createTemplates -->
@@ -137,4 +138,7 @@
 		<xsl:variable name="debbComponentId"
 			select="plm:UserData/plm:UserValue[@title='DEBBComponentId']/@value" />
+
+		<xsl:variable name="debbComponentFile"
+			select="plm:UserData/plm:UserValue[@title='DEBBComponentFile']/@value" />
 	
 		<xsl:attribute name="class">
@@ -144,5 +148,5 @@
 		<xsl:choose>
 			<xsl:when test="$debbLevel = $templateStartLevel">
-				<!-- Change into template. The rest of the hierarchy will be in template. -->
+				<!-- Change into template. The rest of the hierarchy will be in a corresponding template. -->
 				<xsl:element name="templateId">
 					<xsl:value-of select="$debbLevel"/>
@@ -152,4 +156,48 @@
 			</xsl:when>
 			<xsl:otherwise>
+			
+				<!-- Read information from DEBBComponent file -->	
+				<xsl:choose>
+					 <!-- DEBB Components file is defined  -->
+					<xsl:when test="$debbComponentFile != ''">
+						<xsl:comment>
+							DEBB Component file is <xsl:value-of select="$debbComponentFile" />
+						</xsl:comment>
+						<xsl:variable name="nestedDoc" select="document($debbComponentFile)" />
+					
+<!--						<xsl:value-of select="fun:translateDEBBComponent($nestedDoc, $debbComponentFile)"/>-->
+
+						<xsl:apply-templates select="$nestedDoc//*[ComponentId=$debbComponentId]">
+							<xsl:with-param name="computingResourceClasses">
+								<xsl:value-of select="$computingResourceClasses" />
+							</xsl:with-param>
+							<xsl:with-param name="resourceUnitClasses">
+								<xsl:value-of select="$resourceUnitClasses" />
+							</xsl:with-param>
+						</xsl:apply-templates>
+					
+					</xsl:when>
+					 <!-- DEBB Components file is not defined. Use default one.  -->
+					<xsl:otherwise>
+						<xsl:comment>
+							DEBB Component file is <xsl:value-of select="$defaultDEBBComponentsFileName" />
+						</xsl:comment>
+						<xsl:variable name="nestedDoc"
+							select="document($defaultDEBBComponentsFileName)" />
+		
+<!--							<xsl:value-of select="fun:translateDEBBComponent($nestedDoc, $debbComponentFile)"/>-->
+							
+						<xsl:apply-templates select="$nestedDoc//*[ComponentId=$debbComponentId]">
+							<xsl:with-param name="computingResourceClasses">
+								<xsl:value-of select="$computingResourceClasses" />
+							</xsl:with-param>
+							<xsl:with-param name="resourceUnitClasses">
+								<xsl:value-of select="$resourceUnitClasses" />
+							</xsl:with-param>
+						</xsl:apply-templates>
+		
+					</xsl:otherwise>
+				</xsl:choose>			
+			
 				<!-- Iterate children and ask them to translate themselves -->
 				<xsl:for-each select="1 to count($tokenizedText)">
@@ -184,6 +232,5 @@
 				</xsl:attribute>
 				
-				<!-- Read information from DEBBComponent file -->
-		
+				<!-- Read information from DEBBComponent file -->	
 				<xsl:choose>
 					 <!-- DEBB Components file is defined  -->
@@ -355,6 +402,8 @@
 	
 	<xsl:function name="fun:containsTemplates">
-		<xsl:variable name="productRevisionViews" select="$rootDoc//plm:ProductRevisionView[UserData/UserValue/@DEBBLevel=$templateStartLevel]"/>
-		<xsl:value-of select="count($productRevisionViews) > 0"/>
+		<xsl:variable name="productRevisionViews" select="$rootDoc//plm:ProductRevisionView[plm:UserData/plm:UserValue/@title='DEBBLevel' and plm:UserData/plm:UserValue/@value=$templateStartLevel]"/>
+		<xsl:variable name="numberOfTemplates" select="count($productRevisionViews)"/>
+
+		<xsl:value-of select="$numberOfTemplates &gt; 0"/>
 	</xsl:function>	
 	
