Ignore:
Timestamp:
03/13/13 10:06:47 (12 years ago)
Author:
gosiaw
Message:

Creating elements without templates corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/test/DEBBTranslator/xml/PLMXMLTranslator.xsl

    r949 r950  
    1818 
    1919        <!-- Information from which level the translator should start moving information to templates --> 
    20         <xsl:variable name="templateStartLevel" select="'Node'" /> 
     20        <xsl:variable name="templateStartLevel" select="''" /> 
    2121 
    2222        <!-- Specification of the output document --> 
     
    4444                        </xsl:element> 
    4545                         
    46                         <xsl:if test="fun:containsTemplates()"> 
     46                        <!-- Create templates (if needed) --> 
     47                        <xsl:if test="fun:containsTemplates() = true()"> 
    4748                                <xsl:element name="templates"> 
    4849                                        <!-- Iterate the document and createTemplates --> 
     
    137138                <xsl:variable name="debbComponentId" 
    138139                        select="plm:UserData/plm:UserValue[@title='DEBBComponentId']/@value" /> 
     140 
     141                <xsl:variable name="debbComponentFile" 
     142                        select="plm:UserData/plm:UserValue[@title='DEBBComponentFile']/@value" /> 
    139143         
    140144                <xsl:attribute name="class"> 
     
    144148                <xsl:choose> 
    145149                        <xsl:when test="$debbLevel = $templateStartLevel"> 
    146                                 <!-- Change into template. The rest of the hierarchy will be in template. --> 
     150                                <!-- Change into template. The rest of the hierarchy will be in a corresponding template. --> 
    147151                                <xsl:element name="templateId"> 
    148152                                        <xsl:value-of select="$debbLevel"/> 
     
    152156                        </xsl:when> 
    153157                        <xsl:otherwise> 
     158                         
     159                                <!-- Read information from DEBBComponent file -->        
     160                                <xsl:choose> 
     161                                         <!-- DEBB Components file is defined  --> 
     162                                        <xsl:when test="$debbComponentFile != ''"> 
     163                                                <xsl:comment> 
     164                                                        DEBB Component file is <xsl:value-of select="$debbComponentFile" /> 
     165                                                </xsl:comment> 
     166                                                <xsl:variable name="nestedDoc" select="document($debbComponentFile)" /> 
     167                                         
     168<!--                                            <xsl:value-of select="fun:translateDEBBComponent($nestedDoc, $debbComponentFile)"/>--> 
     169 
     170                                                <xsl:apply-templates select="$nestedDoc//*[ComponentId=$debbComponentId]"> 
     171                                                        <xsl:with-param name="computingResourceClasses"> 
     172                                                                <xsl:value-of select="$computingResourceClasses" /> 
     173                                                        </xsl:with-param> 
     174                                                        <xsl:with-param name="resourceUnitClasses"> 
     175                                                                <xsl:value-of select="$resourceUnitClasses" /> 
     176                                                        </xsl:with-param> 
     177                                                </xsl:apply-templates> 
     178                                         
     179                                        </xsl:when> 
     180                                         <!-- DEBB Components file is not defined. Use default one.  --> 
     181                                        <xsl:otherwise> 
     182                                                <xsl:comment> 
     183                                                        DEBB Component file is <xsl:value-of select="$defaultDEBBComponentsFileName" /> 
     184                                                </xsl:comment> 
     185                                                <xsl:variable name="nestedDoc" 
     186                                                        select="document($defaultDEBBComponentsFileName)" /> 
     187                 
     188<!--                                                    <xsl:value-of select="fun:translateDEBBComponent($nestedDoc, $debbComponentFile)"/>--> 
     189                                                         
     190                                                <xsl:apply-templates select="$nestedDoc//*[ComponentId=$debbComponentId]"> 
     191                                                        <xsl:with-param name="computingResourceClasses"> 
     192                                                                <xsl:value-of select="$computingResourceClasses" /> 
     193                                                        </xsl:with-param> 
     194                                                        <xsl:with-param name="resourceUnitClasses"> 
     195                                                                <xsl:value-of select="$resourceUnitClasses" /> 
     196                                                        </xsl:with-param> 
     197                                                </xsl:apply-templates> 
     198                 
     199                                        </xsl:otherwise> 
     200                                </xsl:choose>                    
     201                         
    154202                                <!-- Iterate children and ask them to translate themselves --> 
    155203                                <xsl:for-each select="1 to count($tokenizedText)"> 
     
    184232                                </xsl:attribute> 
    185233                                 
    186                                 <!-- Read information from DEBBComponent file --> 
    187                  
     234                                <!-- Read information from DEBBComponent file -->        
    188235                                <xsl:choose> 
    189236                                         <!-- DEBB Components file is defined  --> 
     
    355402         
    356403        <xsl:function name="fun:containsTemplates"> 
    357                 <xsl:variable name="productRevisionViews" select="$rootDoc//plm:ProductRevisionView[UserData/UserValue/@DEBBLevel=$templateStartLevel]"/> 
    358                 <xsl:value-of select="count($productRevisionViews) > 0"/> 
     404                <xsl:variable name="productRevisionViews" select="$rootDoc//plm:ProductRevisionView[plm:UserData/plm:UserValue/@title='DEBBLevel' and plm:UserData/plm:UserValue/@value=$templateStartLevel]"/> 
     405                <xsl:variable name="numberOfTemplates" select="count($productRevisionViews)"/> 
     406 
     407                <xsl:value-of select="$numberOfTemplates &gt; 0"/> 
    359408        </xsl:function>  
    360409         
Note: See TracChangeset for help on using the changeset viewer.