Ignore:
Timestamp:
11/20/12 09:53:11 (12 years ago)
Author:
gosiaw
Message:

Loading specified DEBB Components file (if present in PLM XML) or default one

File:
1 edited

Legend:

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

    r629 r630  
    33        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:plm="http://www.plmxml.org/Schemas/PLMXMLSchema" 
    44        xmlns:cim="http://www.coolemall.eu/DEBBComponent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     5 
     6        <!-- Importing xslt for translating debb components --> 
    57        <xsl:import href="DEBBComponentTranslator.xsl" /> 
     8 
    69        <!-- Specification of the output document --> 
    710        <xsl:output method="xml" version="1.0" encoding="UTF-8" 
    811                indent="yes" /> 
    912 
     13        <!-- Root of the PLM XML document --> 
     14        <xsl:variable name="rootDoc" select="/" /> 
    1015 
    11         <xsl:variable name="rootDoc" select="/" /> 
     16        <!-- Default DEBBComponents file name (used if it is not specified in PLM  
     17                XML file) --> 
     18        <xsl:variable name="defaultDEBBComponentsFileName" select="'DEBBComponents.xml'" /> 
    1219 
    1320 
     
    4956                <xsl:variable name="debbComponentId" 
    5057                        select="plm:UserData/plm:UserValue[@title='DEBBComponentId']/@value" /> 
     58                <xsl:variable name="debbComponentFile" 
     59                        select="plm:UserData/plm:UserValue[@title='DEBBComponentFile']/@value" /> 
     60 
    5161                <xsl:attribute name="name"> 
    5262                        <xsl:value-of select="$debbComponentId" /> 
    5363                </xsl:attribute> 
    54                 <xsl:variable name="nestedDoc" select="document('DEBBComponents.xml')" /> 
    55                 <xsl:apply-templates select="$nestedDoc//*[ComponentId=$debbComponentId]" /> 
     64                <xsl:choose> 
     65                        <xsl:when test="debbComponentFile != ''"> 
     66                                <xsl:variable name="nestedDoc" select="document($debbComponentFile)" /> 
     67                                <xsl:apply-templates select="$nestedDoc//*[ComponentId=$debbComponentId]" /> 
     68                        </xsl:when> 
     69                        <xsl:otherwise> 
     70                                <xsl:variable name="nestedDoc" 
     71                                        select="document($defaultDEBBComponentsFileName)" /> 
     72                                <xsl:apply-templates select="$nestedDoc//*[ComponentId=$debbComponentId]" /> 
     73                        </xsl:otherwise> 
     74                </xsl:choose> 
     75 
     76 
    5677                <xsl:for-each select="1 to count($tokenizedText)"> 
    5778                        <xsl:variable name="index" select="." /> 
Note: See TracChangeset for help on using the changeset viewer.