# HG changeset patch # User Laurent Bessard # Date 1386270379 -3600 # Node ID 675a6229fc60698e5a1d75b8c900209ef9c4f714 # Parent 8b0a7eceb76d2f3edee83ea2848f342a4b3e84f2 Fixed bugs in SFC when loading transition condition and referenced transition or action body diff -r 8b0a7eceb76d -r 675a6229fc60 plcopen/plcopen.py --- a/plcopen/plcopen.py Thu Dec 05 20:03:27 2013 +0100 +++ b/plcopen/plcopen.py Thu Dec 05 20:06:19 2013 +0100 @@ -1333,7 +1333,7 @@ setattr(cls, "getaction", getaction) def getactionList(self): - if self.actions: + if self.actions is not None: return self.actions.getaction() return [] setattr(cls, "getactionList", getactionList) diff -r 8b0a7eceb76d -r 675a6229fc60 plcopen/pou_block_instances.xslt --- a/plcopen/pou_block_instances.xslt Thu Dec 05 20:03:27 2013 +0100 +++ b/plcopen/pou_block_instances.xslt Thu Dec 05 20:06:19 2013 +0100 @@ -6,7 +6,7 @@ <xsl:template match="text()"> <xsl:param name="_indent" select="0"/> </xsl:template> - <xsl:template match="ppx:pou"> + <xsl:template match="ppx:pou[ppx:body]|ppx:transition[ppx:body]|ppx:action[ppx:body]"> <xsl:param name="_indent" select="0"/> <xsl:apply-templates select="ppx:body/*[self::ppx:FBD or self::ppx:LD or self::ppx:SFC]/*"> <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> @@ -331,11 +331,11 @@ </xsl:variable> <xsl:variable name="condition"> <xsl:choose> - <xsl:when test="ppx:reference"> + <xsl:when test="ppx:condition/ppx:reference"> <xsl:value-of select="ppx:condition/ppx:reference/@name"/> </xsl:when> - <xsl:when test="ppx:inline"> - <xsl:value-of select="ppx:condition/ppx:inline/ppx:body/ppx:ST/xhtml:p/text()"/> + <xsl:when test="ppx:condition/ppx:inline"> + <xsl:value-of select="ppx:condition/ppx:inline/ppx:ST/xhtml:p/text()"/> </xsl:when> </xsl:choose> </xsl:variable> diff -r 8b0a7eceb76d -r 675a6229fc60 plcopen/pou_block_instances.ysl2 --- a/plcopen/pou_block_instances.ysl2 Thu Dec 05 20:03:27 2013 +0100 +++ b/plcopen/pou_block_instances.ysl2 Thu Dec 05 20:06:19 2013 +0100 @@ -7,7 +7,7 @@ template "text()"; - template "ppx:pou" { + template "ppx:pou[ppx:body]|ppx:transition[ppx:body]|ppx:action[ppx:body]" { apply "ppx:body/*[self::ppx:FBD or self::ppx:LD or self::ppx:SFC]/*"; } @@ -238,8 +238,8 @@ } variable "condition" { choose { - when "ppx:reference" > «ppx:condition/ppx:reference/@name» - when "ppx:inline" > «ppx:condition/ppx:inline/ppx:body/ppx:ST/xhtml:p/text()» + when "ppx:condition/ppx:reference" > «ppx:condition/ppx:reference/@name» + when "ppx:condition/ppx:inline" > «ppx:condition/ppx:inline/ppx:ST/xhtml:p/text()» } } value "ns:SetSpecificValues($priority, $condition_type, $condition)";