Fixed instance type tagname computing xslt stylesheet
authorLaurent Bessard
Tue, 24 Sep 2013 14:45:30 +0200
changeset 1326 e2c11668addf
parent 1325 76e52d5fcffd
child 1327 632780979432
Fixed instance type tagname computing xslt stylesheet
PLCControler.py
plcopen/instance_tagname.xslt
--- a/PLCControler.py	Tue Sep 24 12:42:34 2013 +0200
+++ b/PLCControler.py	Tue Sep 24 14:45:30 2013 +0200
@@ -308,7 +308,11 @@
         self.process_children(context, tagname_infos)
         tagname = etree.Element('tagname')
         tagname.text = self.GetTagName(tagname_infos)
-        output_parent.append(tagname)
+        print etree.tostring(tagname)
+        try:
+            output_parent.append(tagname)
+        except:
+            pass
 
 class ConfigTagName(InstanceTagName):
     
--- a/plcopen/instance_tagname.xslt	Tue Sep 24 12:42:34 2013 +0200
+++ b/plcopen/instance_tagname.xslt	Tue Sep 24 14:45:30 2013 +0200
@@ -74,7 +74,7 @@
 	        <xsl:with-param name="path" select="$element_path"/>
 	      </xsl:call-template>
 	    </xsl:variable>
-        <xsl:apply-templates select="ppx:pouInstance[@name=$child_name] | ppx:task|ppx:pouInstance[@name=$child_name] | ppx:globalVars/ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
+        <xsl:apply-templates select="ppx:pouInstance[@name=$child_name] | ppx:task/ppx:pouInstance[@name=$child_name] | ppx:globalVars/ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
           <xsl:with-param name="element_path">
             <xsl:call-template name="next_path">
               <xsl:with-param name="path" select="$element_path"/>
@@ -112,20 +112,15 @@
         <xsl:with-param name="path" select="$element_path"/>
       </xsl:call-template>
     </xsl:variable>
-    <xsl:variable name="next_child_path">
-      <xsl:call-template name="next_path">
-        <xsl:with-param name="path" select="$element_path"/>
-      </xsl:call-template>
-    </xsl:variable>
     <xsl:apply-templates select="ppx:interface/*/ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
-      <xsl:with-param name="next_child_path" select="next_child_path"/>
-    </xsl:apply-templates>
-    <xsl:apply-templates select="ppx:actions/ppx:action[@name=$child_name]">
-      <xsl:with-param name="next_child_path" select="next_child_path"/>
-    </xsl:apply-templates>
-    <xsl:apply-templates select="ppx:transitions/ppx:transition[@name=$child_name]">
-      <xsl:with-param name="next_child_path" select="next_child_path"/>
-    </xsl:apply-templates>
+      <xsl:with-param name="element_path">
+        <xsl:call-template name="next_path">
+          <xsl:with-param name="path" select="$element_path"/>
+        </xsl:call-template>
+      </xsl:with-param>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="ppx:actions/ppx:action[@name=$child_name]"/>
+    <xsl:apply-templates select="ppx:transitions/ppx:transition[@name=$child_name]"/>
   </xsl:template>
   <xsl:template match="ppx:action">
     <ns:action_tagname>