Fix template conflict in XSLT with lxml>=4.9.0. Thanks to GP Orcullo !
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Sat, 13 May 2023 14:28:29 +0200
changeset 3802 8616ffd7c29d
parent 3801 6839dbb9a1df
child 3803 b3394107eb8b
Fix template conflict in XSLT with lxml>=4.9.0. Thanks to GP Orcullo !
plcopen/pou_block_instances.xslt
plcopen/pou_block_instances.ysl2
plcopen/pou_variables.xslt
plcopen/pou_variables.ysl2
plcopen/variables_infos.xslt
plcopen/variables_infos.ysl2
--- a/plcopen/pou_block_instances.xslt	Sat May 13 12:45:03 2023 +0200
+++ b/plcopen/pou_block_instances.xslt	Sat May 13 14:28:29 2023 +0200
@@ -2,7 +2,7 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:func="http://exslt.org/functions" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ns="beremiz" version="1.0" extension-element-prefixes="ns" exclude-result-prefixes="ns">
   <xsl:output method="xml"/>
   <xsl:template match="text()"/>
-  <xsl:template match="ppx:pou[ppx:body]|ppx:transition[ppx:body]|ppx:action[ppx:body]">
+  <xsl:template priority="-1.0" match="ppx:pou[ppx:body]|ppx:transition[ppx:body]|ppx:action[ppx:body]">
     <xsl:apply-templates select="ppx:body/*[self::ppx:FBD or self::ppx:LD or self::ppx:SFC]/*"/>
   </xsl:template>
   <xsl:template name="add_instance">
--- a/plcopen/pou_block_instances.ysl2	Sat May 13 12:45:03 2023 +0200
+++ b/plcopen/pou_block_instances.ysl2	Sat May 13 14:28:29 2023 +0200
@@ -7,7 +7,7 @@
     
     template "text()";
     
-    template "ppx:pou[ppx:body]|ppx:transition[ppx:body]|ppx:action[ppx:body]" {
+    template "ppx:pou[ppx:body]|ppx:transition[ppx:body]|ppx:action[ppx:body]", priority="-1.0" {
         apply "ppx:body/*[self::ppx:FBD or self::ppx:LD or self::ppx:SFC]/*";
     }
     
--- a/plcopen/pou_variables.xslt	Sat May 13 12:45:03 2023 +0200
+++ b/plcopen/pou_variables.xslt	Sat May 13 14:28:29 2023 +0200
@@ -218,7 +218,7 @@
   <xsl:template mode="var_class" match="ppx:pou">
     <xsl:value-of select="@pouType"/>
   </xsl:template>
-  <xsl:template mode="var_class" match="*[self::ppx:type or self::ppx:baseType]/*">
+  <xsl:template mode="var_class" priority="-1.0" match="*[self::ppx:type or self::ppx:baseType]/*">
     <xsl:param name="default_class"/>
     <xsl:value-of select="$default_class"/>
   </xsl:template>
@@ -241,7 +241,7 @@
   <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType]/ppx:wstring">
     <xsl:text>WSTRING</xsl:text>
   </xsl:template>
-  <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType]/*">
+  <xsl:template mode="var_type" priority="-1.0" match="*[self::ppx:type or self::ppx:baseType]/*">
     <xsl:value-of select="local-name()"/>
   </xsl:template>
   <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived">
@@ -259,7 +259,7 @@
   <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/ppx:array">
     <xsl:apply-templates mode="var_edit" select="ppx:baseType"/>
   </xsl:template>
-  <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/*">
+  <xsl:template mode="var_edit" priority="-1.0" match="*[self::ppx:type or self::ppx:baseType]/*">
     <xsl:text>false</xsl:text>
   </xsl:template>
   <xsl:template mode="var_debug" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived">
@@ -283,7 +283,7 @@
   <xsl:template mode="var_debug" match="*[self::ppx:type or self::ppx:baseType]/ppx:struct">
     <xsl:text>false</xsl:text>
   </xsl:template>
-  <xsl:template mode="var_debug" match="*[self::ppx:type or self::ppx:baseType]/*">
+  <xsl:template mode="var_debug" priority="-1.0" match="*[self::ppx:type or self::ppx:baseType]/*">
     <xsl:text>true</xsl:text>
   </xsl:template>
 </xsl:stylesheet>
--- a/plcopen/pou_variables.ysl2	Sat May 13 12:45:03 2023 +0200
+++ b/plcopen/pou_variables.ysl2	Sat May 13 14:28:29 2023 +0200
@@ -188,7 +188,7 @@
         value "@pouType";
     }
     
-    template "*[self::ppx:type or self::ppx:baseType]/*" mode="var_class" {
+    template "*[self::ppx:type or self::ppx:baseType]/*", mode="var_class", priority="-1.0" {
         param "default_class";
         value "$default_class";
     }
@@ -214,7 +214,7 @@
         > WSTRING
     }
   
-    template "*[self::ppx:type or self::ppx:baseType]/*", mode="var_type" {
+    template "*[self::ppx:type or self::ppx:baseType]/*", mode="var_type", priority="-1.0" {
         > «local-name()»
     }
     
@@ -231,7 +231,7 @@
         apply "ppx:baseType", mode="var_edit";
     }
     
-    template "*[self::ppx:type or self::ppx:baseType]/*", mode="var_edit" {
+    template "*[self::ppx:type or self::ppx:baseType]/*", mode="var_edit", priority="-1.0" {
         > false
     }
     
@@ -261,7 +261,7 @@
         > false
     }
     
-    template "*[self::ppx:type or self::ppx:baseType]/*", mode="var_debug" {
+    template "*[self::ppx:type or self::ppx:baseType]/*", mode="var_debug", priority="-1.0" {
         > true
     }
     
--- a/plcopen/variables_infos.xslt	Sat May 13 12:45:03 2023 +0200
+++ b/plcopen/variables_infos.xslt	Sat May 13 14:28:29 2023 +0200
@@ -155,7 +155,7 @@
     </xsl:variable>
     <xsl:value-of select="ns:SetType($name)"/>
   </xsl:template>
-  <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*">
+  <xsl:template mode="var_type" priority="-1.0" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*">
     <xsl:variable name="name">
       <xsl:value-of select="local-name()"/>
     </xsl:variable>
--- a/plcopen/variables_infos.ysl2	Sat May 13 12:45:03 2023 +0200
+++ b/plcopen/variables_infos.ysl2	Sat May 13 14:28:29 2023 +0200
@@ -152,7 +152,7 @@
         value "ns:SetType($name)";
     }
     
-    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*", mode="var_type" {
+    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*", mode="var_type", priority="-1.0" {
         variable "name" > «local-name()»
         value "ns:SetType($name)";
     }