- Timestamp:
- 03/13/13 09:27:32 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/test/DEBBTranslator/xml/PLMXMLTranslator.xsl
r946 r949 17 17 <xsl:param name="resourceUnitClasses" select="resourceUnitClasses" /> 18 18 19 <!-- Information from which level the translator should start moving information to templates --> 20 <xsl:variable name="templateStartLevel" select="'Node'" /> 21 19 22 <!-- Specification of the output document --> 20 23 <xsl:output method="xml" version="1.0" encoding="UTF-8" … … 31 34 <xsl:template match="/"> 32 35 <xsl:element name="environment"> 33 <xsl:attribute name="xsi:noNamespaceSchemaLocation">DCWormsResSchema.xsd</xsl:attribute> 36 <xsl:attribute name="xsi:noNamespaceSchemaLocation">../DCWormsResSchema.xsd</xsl:attribute> 37 34 38 <xsl:element name="resources"> 35 39 <!-- Iterate the document, create hierarchy and "links" to templates --> … … 40 44 </xsl:element> 41 45 42 <xsl:element name="templates"> 43 <!-- Iterate the document and createTemplates --> 44 <xsl:apply-templates select="//plm:InstanceGraph" mode="createTemplates"/> 45 </xsl:element> 46 <xsl:if test="fun:containsTemplates()"> 47 <xsl:element name="templates"> 48 <!-- Iterate the document and createTemplates --> 49 <xsl:apply-templates select="//plm:InstanceGraph" mode="createTemplates"/> 50 </xsl:element> 51 </xsl:if> 46 52 47 53 </xsl:element> … … 55 61 56 62 <xsl:template match="plm:InstanceGraph" mode="createTemplates"> 57 <xsl:apply-templates select=" plm:ProductRevisionView" mode="createTemplates"/>63 <xsl:apply-templates select="//plm:ProductRevisionView[plm:UserData/plm:UserValue/@title='DEBBLevel' and plm:UserData/plm:UserValue/@value=$templateStartLevel]" mode="createTemplates"/> 58 64 </xsl:template> 59 65 … … 68 74 <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute> 69 75 76 77 <!-- Find corresponding ProductRevisionView and let it translate itself --> 78 <!-- <xsl:apply-templates--> 79 <!-- select="//plm:ProductRevisionView[@id=$productInstanceId]" />--> 80 <xsl:apply-templates select="//plm:ProductRevisionView[@id=$productInstanceId]" mode="createHierarchy"/> 70 81 71 82 <!-- Add hostnames, labels, locations, sequences, etc. --> … … 109 120 </xsl:element> 110 121 </xsl:element> 111 </xsl:if> 112 113 <!-- Find corresponding ProductRevisionView and let it translate itself --> 114 <!-- <xsl:apply-templates--> 115 <!-- select="//plm:ProductRevisionView[@id=$productInstanceId]" />--> 116 <xsl:apply-templates select="//plm:ProductRevisionView[@id=$productInstanceId]" mode="createHierarchy"/> 117 118 122 </xsl:if> 119 123 </xsl:element> 120 124 </xsl:if> … … 134 138 select="plm:UserData/plm:UserValue[@title='DEBBComponentId']/@value" /> 135 139 136 <xsl: element name="templateId">140 <xsl:attribute name="class"> 137 141 <xsl:value-of select="$debbLevel"/> 138 <xsl:text>-</xsl:text> 139 <xsl:value-of select="$debbComponentId"/> 140 </xsl:element> 141 142 <!-- Iterate children and ask them to translate themselves --> 143 <xsl:for-each select="1 to count($tokenizedText)"> 144 <xsl:variable name="index" select="." /> 145 <xsl:apply-templates 146 select="$rootDoc//plm:ProductInstance[@id=$tokenizedText[$index]]" mode="createHierarchy"/> 147 </xsl:for-each> 148 142 </xsl:attribute> 143 144 <xsl:choose> 145 <xsl:when test="$debbLevel = $templateStartLevel"> 146 <!-- Change into template. The rest of the hierarchy will be in template. --> 147 <xsl:element name="templateId"> 148 <xsl:value-of select="$debbLevel"/> 149 <xsl:text>-</xsl:text> 150 <xsl:value-of select="$debbComponentId"/> 151 </xsl:element> 152 </xsl:when> 153 <xsl:otherwise> 154 <!-- Iterate children and ask them to translate themselves --> 155 <xsl:for-each select="1 to count($tokenizedText)"> 156 <xsl:variable name="index" select="." /> 157 <xsl:apply-templates 158 select="$rootDoc//plm:ProductInstance[@id=$tokenizedText[$index]]" mode="createHierarchy"/> 159 </xsl:for-each> 160 </xsl:otherwise> 161 </xsl:choose> 149 162 </xsl:template> 150 163 … … 341 354 342 355 356 <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"/> 359 </xsl:function> 343 360 344 361 </xsl:stylesheet>
Note: See TracChangeset
for help on using the changeset viewer.