# HG changeset patch # User Laurent Bessard # Date 1381348881 -7200 # Node ID be6c3a03684492711e3e55deeda488dc1ff495e2 # Parent aee0a7eb833af5d26d11fc7fd97794a9913864fd Fixed xslt stylesheets with pretty print versions diff -r aee0a7eb833a -r be6c3a036844 plcopen/pou_block_instances.xslt --- a/plcopen/pou_block_instances.xslt Wed Oct 09 22:00:23 2013 +0200 +++ b/plcopen/pou_block_instances.xslt Wed Oct 09 22:01:21 2013 +0200 @@ -1,1 +1,452 @@ -<xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:dyn="http://exslt.org/dynamic" xmlns:str="http://exslt.org/strings" xmlns:math="http://exslt.org/math" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="ns" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:yml="http://fdik.org/yml" xmlns:set="http://exslt.org/sets" version="1.0" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:ns="pou_block_instances_ns" exclude-result-prefixes="ns" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml"/><xsl:variable name="space" select="' '"/><xsl:param name="autoindent" select="4"/><xsl:template match="text()"><xsl:param name="_indent" select="0"/></xsl:template><xsl:template match="ppx:pou"><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"/></xsl:apply-templates></xsl:template><xsl:template name="add_instance"><xsl:param name="_indent" select="0"/><xsl:param name="type"/><xsl:value-of select="ns:AddBlockInstance($type, @localId, ppx:position/@x, ppx:position/@y, @width, @height)"/></xsl:template><xsl:template name="execution_order"><xsl:param name="_indent" select="0"/><xsl:choose><xsl:when test="@executionOrderId"><xsl:value-of select="@executionOrderId"/></xsl:when><xsl:otherwise><xsl:text>0</xsl:text></xsl:otherwise></xsl:choose></xsl:template><xsl:template name="ConnectionInfos"><xsl:param name="_indent" select="0"/><xsl:param name="type"/><xsl:param name="negated"/><xsl:param name="edge"/><xsl:param name="formalParameter"/><xsl:value-of select="ns:AddInstanceConnection($type, $formalParameter, $negated, $edge, ppx:relPosition/@x, ppx:relPosition/@y)"/></xsl:template><xsl:template match="ppx:position"><xsl:param name="_indent" select="0"/><xsl:value-of select="ns:AddLinkPoint(@x, @y)"/></xsl:template><xsl:template match="ppx:connection"><xsl:param name="_indent" select="0"/><xsl:value-of select="ns:AddConnectionLink(@refLocalId, @formalParameter)"/><xsl:apply-templates select="ppx:position"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:connectionPointIn"><xsl:param name="_indent" select="0"/><xsl:param name="negated"/><xsl:param name="edge"/><xsl:param name="formalParameter"/><xsl:call-template name="ConnectionInfos"><xsl:with-param name="type"><xsl:text>input</xsl:text></xsl:with-param><xsl:with-param name="negated"><xsl:value-of select="$negated"/></xsl:with-param><xsl:with-param name="edge"><xsl:value-of select="$edge"/></xsl:with-param><xsl:with-param name="formalParameter"><xsl:value-of select="$formalParameter"/></xsl:with-param></xsl:call-template><xsl:apply-templates select="ppx:connection"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:connectionPointOut"><xsl:param name="_indent" select="0"/><xsl:param name="negated"/><xsl:param name="edge"/><xsl:param name="formalParameter"/><xsl:call-template name="ConnectionInfos"><xsl:with-param name="type"><xsl:text>output</xsl:text></xsl:with-param><xsl:with-param name="negated"><xsl:value-of select="$negated"/></xsl:with-param><xsl:with-param name="edge"><xsl:value-of select="$edge"/></xsl:with-param><xsl:with-param name="formalParameter"><xsl:value-of select="$formalParameter"/></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:connectionPointOutAction"><xsl:param name="_indent" select="0"/><xsl:call-template name="ConnectionInfos"><xsl:with-param name="type"><xsl:text>output</xsl:text></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:comment"><xsl:param name="_indent" select="0"/><xsl:value-of select="ns:SetSpecificValues(ppx:content/xhtml:p/text())"/><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="local-name()"/></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:block"><xsl:param name="_indent" select="0"/><xsl:variable name="execution_order"><xsl:call-template name="execution_order"></xsl:call-template></xsl:variable><xsl:value-of select="ns:SetSpecificValues(@instanceName, $execution_order)"/><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="@typeName"/></xsl:with-param></xsl:call-template><xsl:for-each select="ppx:inputVariables/ppx:variable"><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/><xsl:with-param name="negated" select="@negated"/><xsl:with-param name="edge" select="@edge"/><xsl:with-param name="formalParameter" select="@formalParameter"/></xsl:apply-templates></xsl:for-each><xsl:for-each select="ppx:outputVariables/ppx:variable"><xsl:apply-templates select="ppx:connectionPointOut"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/><xsl:with-param name="negated" select="@negated"/><xsl:with-param name="edge" select="@edge"/><xsl:with-param name="formalParameter" select="@formalParameter"/></xsl:apply-templates></xsl:for-each></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived"><xsl:param name="_indent" select="0"/><xsl:value-of select="@name"/></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string"><xsl:param name="_indent" select="0"/><xsl:text>STRING</xsl:text></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring"><xsl:param name="_indent" select="0"/><xsl:text>WSTRING</xsl:text></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*"><xsl:param name="_indent" select="0"/><xsl:value-of select="local-name()"/></xsl:template><xsl:template name="VariableBlockInfos"><xsl:param name="_indent" select="0"/><xsl:param name="type"/><xsl:variable name="expression"><xsl:value-of select="ppx:expression/text()"/></xsl:variable><xsl:variable name="value_type"><xsl:choose><xsl:when test="ancestor::ppx:transition[@name=$expression]"><xsl:text>BOOL</xsl:text></xsl:when><xsl:when test="ancestor::ppx:pou[@name=$expression]"><xsl:apply-templates select="ancestor::ppx:pou/child::ppx:interface/ppx:returnType"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:when><xsl:otherwise><xsl:apply-templates select="ancestor::ppx:pou/child::ppx:interface/*/ppx:variable[@name=$expression]/ppx:type"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="execution_order"><xsl:call-template name="execution_order"></xsl:call-template></xsl:variable><xsl:value-of select="ns:SetSpecificValues($expression, $value_type, $execution_order)"/><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="$type"/></xsl:with-param></xsl:call-template><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/><xsl:with-param name="negated" select="@negatedIn"/><xsl:with-param name="edge" select="@edgeIn"/></xsl:apply-templates><xsl:apply-templates select="ppx:connectionPointOut"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/><xsl:with-param name="negated" select="@negatedOut"/><xsl:with-param name="edge" select="@edgeOut"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:inVariable"><xsl:param name="_indent" select="0"/><xsl:call-template name="VariableBlockInfos"><xsl:with-param name="type" select="'input'"/></xsl:call-template></xsl:template><xsl:template match="ppx:outVariable"><xsl:param name="_indent" select="0"/><xsl:call-template name="VariableBlockInfos"><xsl:with-param name="type" select="'output'"/></xsl:call-template></xsl:template><xsl:template match="ppx:inOutVariable"><xsl:param name="_indent" select="0"/><xsl:call-template name="VariableBlockInfos"><xsl:with-param name="type" select="'inout'"/></xsl:call-template></xsl:template><xsl:template match="ppx:connector|ppx:continuation"><xsl:param name="_indent" select="0"/><xsl:value-of select="ns:SetSpecificValues(@name)"/><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="local-name()"/></xsl:with-param></xsl:call-template><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:apply-templates select="ppx:connectionPointOut"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:leftPowerRail|ppx:rightPowerRail"><xsl:param name="_indent" select="0"/><xsl:variable name="type" select="local-name()"/><xsl:variable name="connectors"><xsl:choose><xsl:when test="$type='leftPowerRail'"><xsl:value-of select="count(ppx:connectionPointOut)"/></xsl:when><xsl:otherwise><xsl:value-of select="count(ppx:connectionPointIn)"/></xsl:otherwise></xsl:choose></xsl:variable><xsl:value-of select="ns:SetSpecificValues($connectors)"/><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="$type"/></xsl:with-param></xsl:call-template><xsl:choose><xsl:when test="$type='leftPowerRail'"><xsl:apply-templates select="ppx:connectionPointOut"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:when><xsl:otherwise><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:otherwise></xsl:choose></xsl:template><xsl:template match="ppx:contact|ppx:coil"><xsl:param name="_indent" select="0"/><xsl:variable name="type" select="local-name()"/><xsl:variable name="storage"><xsl:choose><xsl:when test="$type='coil'"><xsl:value-of select="@storage"/></xsl:when></xsl:choose></xsl:variable><xsl:variable name="execution_order"><xsl:call-template name="execution_order"></xsl:call-template></xsl:variable><xsl:value-of select="ns:SetSpecificValues(ppx:variable/text(), @negated, @edge, $storage, $execution_order)"/><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="$type"/></xsl:with-param></xsl:call-template><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:apply-templates select="ppx:connectionPointOut"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:step"><xsl:param name="_indent" select="0"/><xsl:value-of select="ns:SetSpecificValues(@name, @initialStep)"/><xsl:apply-templates select="ppx:connectionPointOutAction"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/><xsl:with-param name="negated" select="@negated"/></xsl:apply-templates><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="local-name()"/></xsl:with-param></xsl:call-template><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:apply-templates select="ppx:connectionPointOut"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:transition"><xsl:param name="_indent" select="0"/><xsl:variable name="priority"><xsl:choose><xsl:when test="@priority"><xsl:value-of select="@priority"/></xsl:when><xsl:otherwise><xsl:text>0</xsl:text></xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="condition_type"><xsl:choose><xsl:when test="ppx:condition/ppx:connectionPointIn"><xsl:text>connection</xsl:text></xsl:when><xsl:when test="ppx:condition/ppx:reference"><xsl:text>reference</xsl:text></xsl:when><xsl:when test="ppx:condition/ppx:inline"><xsl:text>inline</xsl:text></xsl:when></xsl:choose></xsl:variable><xsl:variable name="condition"><xsl:choose><xsl:when test="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></xsl:choose></xsl:variable><xsl:value-of select="ns:SetSpecificValues($priority, $condition_type, $condition)"/><xsl:apply-templates select="ppx:condition/ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/><xsl:with-param name="negated" select="ppx:condition/@negated"/></xsl:apply-templates><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="local-name()"/></xsl:with-param></xsl:call-template><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:apply-templates select="ppx:connectionPointOut"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:selectionDivergence|ppx:selectionConvergence|ppx:simultaneousDivergence|ppx:simultaneousConvergence"><xsl:param name="_indent" select="0"/><xsl:variable name="type"><xsl:value-of select="local-name()"/></xsl:variable><xsl:variable name="connectors"><xsl:choose><xsl:when test="$type='selectionDivergence' or $type='simultaneousDivergence'"><xsl:value-of select="count(ppx:connectionPointOut)"/></xsl:when><xsl:otherwise><xsl:value-of select="count(ppx:connectionPointIn)"/></xsl:otherwise></xsl:choose></xsl:variable><xsl:value-of select="ns:SetSpecificValues($connectors)"/><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="$type"/></xsl:with-param></xsl:call-template><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:apply-templates select="ppx:connectionPointOut"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:jumpStep"><xsl:param name="_indent" select="0"/><xsl:variable name="type"><xsl:text>jump</xsl:text></xsl:variable><xsl:value-of select="ns:SetSpecificValues(@targetName)"/><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="$type"/></xsl:with-param></xsl:call-template><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:action"><xsl:param name="_indent" select="0"/><xsl:variable name="type"><xsl:choose><xsl:when test="ppx:reference"><xsl:text>reference</xsl:text></xsl:when><xsl:when test="ppx:inline"><xsl:text>inline</xsl:text></xsl:when></xsl:choose></xsl:variable><xsl:variable name="value"><xsl:choose><xsl:when test="ppx:reference"><xsl:value-of select="ppx:reference/@name"/></xsl:when><xsl:when test="ppx:inline"><xsl:value-of select="ppx:inline/ppx:ST/xhtml:p/text()"/></xsl:when></xsl:choose></xsl:variable><xsl:variable name="qualifier"><xsl:choose><xsl:when test="@qualifier"><xsl:value-of select="@qualifier"/></xsl:when><xsl:otherwise><xsl:text>N</xsl:text></xsl:otherwise></xsl:choose></xsl:variable><xsl:value-of select="ns:AddAction($qualifier, $type, $value, @duration, @indicator)"/></xsl:template><xsl:template match="ppx:actionBlock"><xsl:param name="_indent" select="0"/><xsl:value-of select="ns:SetSpecificValues()"/><xsl:apply-templates select="ppx:action"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:call-template name="add_instance"><xsl:with-param name="type"><xsl:value-of select="local-name()"/></xsl:with-param></xsl:call-template><xsl:apply-templates select="ppx:connectionPointIn"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/><xsl:with-param name="negated" select="@negated"/></xsl:apply-templates></xsl:template></xsl:stylesheet> \ No newline at end of file +<?xml version="1.0"?> +<xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:dyn="http://exslt.org/dynamic" xmlns:str="http://exslt.org/strings" xmlns:math="http://exslt.org/math" xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:yml="http://fdik.org/yml" xmlns:set="http://exslt.org/sets" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:ns="pou_block_instances_ns" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="ns" version="1.0" exclude-result-prefixes="ns"> + <xsl:output method="xml"/> + <xsl:variable name="space" select="' '"/> + <xsl:param name="autoindent" select="4"/> + <xsl:template match="text()"> + <xsl:param name="_indent" select="0"/> + </xsl:template> + <xsl:template match="ppx:pou"> + <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"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template name="add_instance"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="type"/> + <xsl:value-of select="ns:AddBlockInstance($type, @localId, ppx:position/@x, ppx:position/@y, @width, @height)"/> + </xsl:template> + <xsl:template name="execution_order"> + <xsl:param name="_indent" select="0"/> + <xsl:choose> + <xsl:when test="@executionOrderId"> + <xsl:value-of select="@executionOrderId"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="ConnectionInfos"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="type"/> + <xsl:param name="negated"/> + <xsl:param name="edge"/> + <xsl:param name="formalParameter"/> + <xsl:value-of select="ns:AddInstanceConnection($type, $formalParameter, $negated, $edge, ppx:relPosition/@x, ppx:relPosition/@y)"/> + </xsl:template> + <xsl:template match="ppx:position"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="ns:AddLinkPoint(@x, @y)"/> + </xsl:template> + <xsl:template match="ppx:connection"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="ns:AddConnectionLink(@refLocalId, @formalParameter)"/> + <xsl:apply-templates select="ppx:position"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:connectionPointIn"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="negated"/> + <xsl:param name="edge"/> + <xsl:param name="formalParameter"/> + <xsl:call-template name="ConnectionInfos"> + <xsl:with-param name="type"> + <xsl:text>input</xsl:text> + </xsl:with-param> + <xsl:with-param name="negated"> + <xsl:value-of select="$negated"/> + </xsl:with-param> + <xsl:with-param name="edge"> + <xsl:value-of select="$edge"/> + </xsl:with-param> + <xsl:with-param name="formalParameter"> + <xsl:value-of select="$formalParameter"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="ppx:connection"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:connectionPointOut"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="negated"/> + <xsl:param name="edge"/> + <xsl:param name="formalParameter"/> + <xsl:call-template name="ConnectionInfos"> + <xsl:with-param name="type"> + <xsl:text>output</xsl:text> + </xsl:with-param> + <xsl:with-param name="negated"> + <xsl:value-of select="$negated"/> + </xsl:with-param> + <xsl:with-param name="edge"> + <xsl:value-of select="$edge"/> + </xsl:with-param> + <xsl:with-param name="formalParameter"> + <xsl:value-of select="$formalParameter"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:connectionPointOutAction"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="ConnectionInfos"> + <xsl:with-param name="type"> + <xsl:text>output</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:comment"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="ns:SetSpecificValues(ppx:content/xhtml:p/text())"/> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="local-name()"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:block"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="execution_order"> + <xsl:call-template name="execution_order"/> + </xsl:variable> + <xsl:value-of select="ns:SetSpecificValues(@instanceName, $execution_order)"/> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="@typeName"/> + </xsl:with-param> + </xsl:call-template> + <xsl:for-each select="ppx:inputVariables/ppx:variable"> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:with-param name="negated" select="@negated"/> + <xsl:with-param name="edge" select="@edge"/> + <xsl:with-param name="formalParameter" select="@formalParameter"/> + </xsl:apply-templates> + </xsl:for-each> + <xsl:for-each select="ppx:outputVariables/ppx:variable"> + <xsl:apply-templates select="ppx:connectionPointOut"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:with-param name="negated" select="@negated"/> + <xsl:with-param name="edge" select="@edge"/> + <xsl:with-param name="formalParameter" select="@formalParameter"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="@name"/> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string"> + <xsl:param name="_indent" select="0"/> + <xsl:text>STRING</xsl:text> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring"> + <xsl:param name="_indent" select="0"/> + <xsl:text>WSTRING</xsl:text> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="local-name()"/> + </xsl:template> + <xsl:template name="VariableBlockInfos"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="type"/> + <xsl:variable name="expression"> + <xsl:value-of select="ppx:expression/text()"/> + </xsl:variable> + <xsl:variable name="value_type"> + <xsl:choose> + <xsl:when test="ancestor::ppx:transition[@name=$expression]"> + <xsl:text>BOOL</xsl:text> + </xsl:when> + <xsl:when test="ancestor::ppx:pou[@name=$expression]"> + <xsl:apply-templates select="ancestor::ppx:pou/child::ppx:interface/ppx:returnType"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="ancestor::ppx:pou/child::ppx:interface/*/ppx:variable[@name=$expression]/ppx:type"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="execution_order"> + <xsl:call-template name="execution_order"/> + </xsl:variable> + <xsl:value-of select="ns:SetSpecificValues($expression, $value_type, $execution_order)"/> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="$type"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:with-param name="negated" select="@negatedIn"/> + <xsl:with-param name="edge" select="@edgeIn"/> + </xsl:apply-templates> + <xsl:apply-templates select="ppx:connectionPointOut"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:with-param name="negated" select="@negatedOut"/> + <xsl:with-param name="edge" select="@edgeOut"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:inVariable"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="VariableBlockInfos"> + <xsl:with-param name="type" select="'input'"/> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:outVariable"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="VariableBlockInfos"> + <xsl:with-param name="type" select="'output'"/> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:inOutVariable"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="VariableBlockInfos"> + <xsl:with-param name="type" select="'inout'"/> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:connector|ppx:continuation"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="ns:SetSpecificValues(@name)"/> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="local-name()"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:apply-templates select="ppx:connectionPointOut"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:leftPowerRail|ppx:rightPowerRail"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="type" select="local-name()"/> + <xsl:variable name="connectors"> + <xsl:choose> + <xsl:when test="$type='leftPowerRail'"> + <xsl:value-of select="count(ppx:connectionPointOut)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="count(ppx:connectionPointIn)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="ns:SetSpecificValues($connectors)"/> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="$type"/> + </xsl:with-param> + </xsl:call-template> + <xsl:choose> + <xsl:when test="$type='leftPowerRail'"> + <xsl:apply-templates select="ppx:connectionPointOut"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="ppx:contact|ppx:coil"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="type" select="local-name()"/> + <xsl:variable name="storage"> + <xsl:choose> + <xsl:when test="$type='coil'"> + <xsl:value-of select="@storage"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="execution_order"> + <xsl:call-template name="execution_order"/> + </xsl:variable> + <xsl:value-of select="ns:SetSpecificValues(ppx:variable/text(), @negated, @edge, $storage, $execution_order)"/> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="$type"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:apply-templates select="ppx:connectionPointOut"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:step"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="ns:SetSpecificValues(@name, @initialStep)"/> + <xsl:apply-templates select="ppx:connectionPointOutAction"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:with-param name="negated" select="@negated"/> + </xsl:apply-templates> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="local-name()"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:apply-templates select="ppx:connectionPointOut"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:transition"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="priority"> + <xsl:choose> + <xsl:when test="@priority"> + <xsl:value-of select="@priority"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="condition_type"> + <xsl:choose> + <xsl:when test="ppx:condition/ppx:connectionPointIn"> + <xsl:text>connection</xsl:text> + </xsl:when> + <xsl:when test="ppx:condition/ppx:reference"> + <xsl:text>reference</xsl:text> + </xsl:when> + <xsl:when test="ppx:condition/ppx:inline"> + <xsl:text>inline</xsl:text> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="condition"> + <xsl:choose> + <xsl:when test="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> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="ns:SetSpecificValues($priority, $condition_type, $condition)"/> + <xsl:apply-templates select="ppx:condition/ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:with-param name="negated" select="ppx:condition/@negated"/> + </xsl:apply-templates> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="local-name()"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:apply-templates select="ppx:connectionPointOut"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:selectionDivergence|ppx:selectionConvergence|ppx:simultaneousDivergence|ppx:simultaneousConvergence"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="type"> + <xsl:value-of select="local-name()"/> + </xsl:variable> + <xsl:variable name="connectors"> + <xsl:choose> + <xsl:when test="$type='selectionDivergence' or $type='simultaneousDivergence'"> + <xsl:value-of select="count(ppx:connectionPointOut)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="count(ppx:connectionPointIn)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="ns:SetSpecificValues($connectors)"/> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="$type"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:apply-templates select="ppx:connectionPointOut"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:jumpStep"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="type"> + <xsl:text>jump</xsl:text> + </xsl:variable> + <xsl:value-of select="ns:SetSpecificValues(@targetName)"/> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="$type"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:action"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="type"> + <xsl:choose> + <xsl:when test="ppx:reference"> + <xsl:text>reference</xsl:text> + </xsl:when> + <xsl:when test="ppx:inline"> + <xsl:text>inline</xsl:text> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="value"> + <xsl:choose> + <xsl:when test="ppx:reference"> + <xsl:value-of select="ppx:reference/@name"/> + </xsl:when> + <xsl:when test="ppx:inline"> + <xsl:value-of select="ppx:inline/ppx:ST/xhtml:p/text()"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="qualifier"> + <xsl:choose> + <xsl:when test="@qualifier"> + <xsl:value-of select="@qualifier"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>N</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="ns:AddAction($qualifier, $type, $value, @duration, @indicator)"/> + </xsl:template> + <xsl:template match="ppx:actionBlock"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="ns:SetSpecificValues()"/> + <xsl:apply-templates select="ppx:action"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:call-template name="add_instance"> + <xsl:with-param name="type"> + <xsl:value-of select="local-name()"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="ppx:connectionPointIn"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:with-param name="negated" select="@negated"/> + </xsl:apply-templates> + </xsl:template> +</xsl:stylesheet> diff -r aee0a7eb833a -r be6c3a036844 plcopen/variables_infos.xslt --- a/plcopen/variables_infos.xslt Wed Oct 09 22:00:23 2013 +0200 +++ b/plcopen/variables_infos.xslt Wed Oct 09 22:01:21 2013 +0200 @@ -1,1 +1,295 @@ -<xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:dyn="http://exslt.org/dynamic" xmlns:str="http://exslt.org/strings" xmlns:math="http://exslt.org/math" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="ns" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:yml="http://fdik.org/yml" xmlns:set="http://exslt.org/sets" version="1.0" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:ns="var_infos_ns" exclude-result-prefixes="ns" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml"/><xsl:variable name="space" select="' '"/><xsl:param name="autoindent" select="4"/><xsl:param name="tree"/><xsl:template match="text()"><xsl:param name="_indent" select="0"/></xsl:template><xsl:variable name="project"><xsl:choose><xsl:when test="$tree='True'"><xsl:copy-of select="document('project')/project/*"/></xsl:when></xsl:choose></xsl:variable><xsl:variable name="stdlib"><xsl:choose><xsl:when test="$tree='True'"><xsl:copy-of select="document('stdlib')/stdlib/*"/></xsl:when></xsl:choose></xsl:variable><xsl:variable name="extensions"><xsl:choose><xsl:when test="$tree='True'"><xsl:copy-of select="document('extensions')/extensions/*"/></xsl:when></xsl:choose></xsl:variable><xsl:template match="ppx:returnType"><xsl:param name="_indent" select="0"/><xsl:value-of select="ns:AddTree()"/><xsl:apply-templates><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template name="variables_infos"><xsl:param name="_indent" select="0"/><xsl:param name="var_class"/><xsl:variable name="var_option"><xsl:choose><xsl:when test="@constant='true' or @constant='1'"><xsl:text>Constant</xsl:text></xsl:when><xsl:when test="@retain='true' or @retain='1'"><xsl:text>Retain</xsl:text></xsl:when><xsl:when test="@nonretain='true' or @nonretain='1'"><xsl:text>Non-Retain</xsl:text></xsl:when></xsl:choose></xsl:variable><xsl:for-each select="ppx:variable"><xsl:variable name="initial_value"><xsl:apply-templates select="ppx:initialValue"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:variable><xsl:variable name="edit"><xsl:choose><xsl:when test="$var_class='Global' or $var_class='External'"><xsl:text>true</xsl:text></xsl:when><xsl:otherwise><xsl:apply-templates mode="var_edit" select="ppx:type"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:otherwise></xsl:choose></xsl:variable><xsl:value-of select="ns:AddTree()"/><xsl:apply-templates select="ppx:type"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:value-of select="ns:AddVariable(@name, $var_class, $var_option, @address, $initial_value, $edit, ppx:documentation/xhtml:p/text())"/></xsl:for-each></xsl:template><xsl:template match="ppx:localVars"><xsl:param name="_indent" select="0"/><xsl:call-template name="variables_infos"><xsl:with-param name="var_class"><xsl:text>Local</xsl:text></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:globalVars"><xsl:param name="_indent" select="0"/><xsl:call-template name="variables_infos"><xsl:with-param name="var_class"><xsl:text>Global</xsl:text></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:externalVars"><xsl:param name="_indent" select="0"/><xsl:call-template name="variables_infos"><xsl:with-param name="var_class"><xsl:text>External</xsl:text></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:tempVars"><xsl:param name="_indent" select="0"/><xsl:call-template name="variables_infos"><xsl:with-param name="var_class"><xsl:text>Temp</xsl:text></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:inputVars"><xsl:param name="_indent" select="0"/><xsl:call-template name="variables_infos"><xsl:with-param name="var_class"><xsl:text>Input</xsl:text></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:outputVars"><xsl:param name="_indent" select="0"/><xsl:call-template name="variables_infos"><xsl:with-param name="var_class"><xsl:text>Output</xsl:text></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:inOutVars"><xsl:param name="_indent" select="0"/><xsl:call-template name="variables_infos"><xsl:with-param name="var_class"><xsl:text>InOut</xsl:text></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:pou"><xsl:param name="_indent" select="0"/><xsl:apply-templates select="ppx:interface/*[self::ppx:inputVars or self::ppx:inOutVars or self::ppx:outputVars]/ppx:variable"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="ppx:variable"><xsl:param name="_indent" select="0"/><xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable><xsl:value-of select="ns:AddTree($name)"/><xsl:apply-templates select="ppx:type"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:value-of select="ns:AddVarToTree($name)"/></xsl:template><xsl:template match="ppx:dataType"><xsl:param name="_indent" select="0"/><xsl:apply-templates select="ppx:baseType"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:struct"><xsl:param name="_indent" select="0"/><xsl:apply-templates select="ppx:variable"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived"><xsl:param name="_indent" select="0"/><xsl:variable name="type_name"><xsl:value-of select="@name"/></xsl:variable><xsl:choose><xsl:when test="$tree='True'"><xsl:apply-templates select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:when></xsl:choose><xsl:value-of select="ns:SetType($type_name)"/></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:array"><xsl:param name="_indent" select="0"/><xsl:apply-templates select="ppx:baseType"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:for-each select="ppx:dimension"><xsl:value-of select="ns:AddDimension(@lower, @upper)"/></xsl:for-each></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string"><xsl:param name="_indent" select="0"/><xsl:variable name="name"><xsl:text>STRING</xsl:text></xsl:variable><xsl:value-of select="ns:SetType($name)"/></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring"><xsl:param name="_indent" select="0"/><xsl:variable name="name"><xsl:text>WSTRING</xsl:text></xsl:variable><xsl:value-of select="ns:SetType($name)"/></xsl:template><xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*"><xsl:param name="_indent" select="0"/><xsl:variable name="name"><xsl:value-of select="local-name()"/></xsl:variable><xsl:value-of select="ns:SetType($name)"/></xsl:template><xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived"><xsl:param name="_indent" select="0"/><xsl:variable name="type_name" select="@name"/><xsl:variable name="pou_infos"><xsl:copy-of select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/></xsl:variable><xsl:choose><xsl:when test="$pou_infos != ''"><xsl:text>false</xsl:text></xsl:when><xsl:otherwise><xsl:text>true</xsl:text></xsl:otherwise></xsl:choose></xsl:template><xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*"><xsl:param name="_indent" select="0"/><xsl:text>true</xsl:text></xsl:template><xsl:template match="ppx:value"><xsl:param name="_indent" select="0"/><xsl:choose><xsl:when test="@repetitionValue"><xsl:value-of select="@repetitionValue"/><xsl:text>(</xsl:text><xsl:apply-templates><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:text>)</xsl:text></xsl:when><xsl:when test="@member"><xsl:value-of select="@member"/><xsl:text> := </xsl:text><xsl:apply-templates><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:when><xsl:otherwise><xsl:apply-templates><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates></xsl:otherwise></xsl:choose></xsl:template><xsl:template match="ppx:simpleValue"><xsl:param name="_indent" select="0"/><xsl:value-of select="@value"/></xsl:template><xsl:template name="complex_type_value"><xsl:param name="_indent" select="0"/><xsl:param name="start_bracket"/><xsl:param name="end_bracket"/><xsl:value-of select="@start_bracket"/><xsl:for-each select="ppx:value"><xsl:apply-templates select="."><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:choose><xsl:when test="position()!=last()"><xsl:text>, </xsl:text></xsl:when></xsl:choose></xsl:for-each><xsl:value-of select="@end_bracket"/></xsl:template><xsl:template match="ppx:arrayValue"><xsl:param name="_indent" select="0"/><xsl:call-template name="complex_type_value"><xsl:with-param name="start_bracket"><xsl:text>[</xsl:text></xsl:with-param><xsl:with-param name="end_bracket"><xsl:text>]</xsl:text></xsl:with-param></xsl:call-template></xsl:template><xsl:template match="ppx:structValue"><xsl:param name="_indent" select="0"/><xsl:call-template name="complex_type_value"><xsl:with-param name="start_bracket"><xsl:text>(</xsl:text></xsl:with-param><xsl:with-param name="end_bracket"><xsl:text>)</xsl:text></xsl:with-param></xsl:call-template></xsl:template></xsl:stylesheet> \ No newline at end of file +<?xml version="1.0"?> +<xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:dyn="http://exslt.org/dynamic" xmlns:str="http://exslt.org/strings" xmlns:math="http://exslt.org/math" xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:yml="http://fdik.org/yml" xmlns:set="http://exslt.org/sets" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:ns="var_infos_ns" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="ns" version="1.0" exclude-result-prefixes="ns"> + <xsl:output method="xml"/> + <xsl:variable name="space" select="' '"/> + <xsl:param name="autoindent" select="4"/> + <xsl:param name="tree"/> + <xsl:template match="text()"> + <xsl:param name="_indent" select="0"/> + </xsl:template> + <xsl:variable name="project"> + <xsl:choose> + <xsl:when test="$tree='True'"> + <xsl:copy-of select="document('project')/project/*"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="stdlib"> + <xsl:choose> + <xsl:when test="$tree='True'"> + <xsl:copy-of select="document('stdlib')/stdlib/*"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="extensions"> + <xsl:choose> + <xsl:when test="$tree='True'"> + <xsl:copy-of select="document('extensions')/extensions/*"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:template match="ppx:returnType"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="ns:AddTree()"/> + <xsl:apply-templates> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template name="variables_infos"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="var_class"/> + <xsl:variable name="var_option"> + <xsl:choose> + <xsl:when test="@constant='true' or @constant='1'"> + <xsl:text>Constant</xsl:text> + </xsl:when> + <xsl:when test="@retain='true' or @retain='1'"> + <xsl:text>Retain</xsl:text> + </xsl:when> + <xsl:when test="@nonretain='true' or @nonretain='1'"> + <xsl:text>Non-Retain</xsl:text> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:for-each select="ppx:variable"> + <xsl:variable name="initial_value"> + <xsl:apply-templates select="ppx:initialValue"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:variable> + <xsl:variable name="edit"> + <xsl:choose> + <xsl:when test="$var_class='Global' or $var_class='External'"> + <xsl:text>true</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates mode="var_edit" select="ppx:type"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="ns:AddTree()"/> + <xsl:apply-templates select="ppx:type"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:value-of select="ns:AddVariable(@name, $var_class, $var_option, @address, $initial_value, $edit, ppx:documentation/xhtml:p/text())"/> + </xsl:for-each> + </xsl:template> + <xsl:template match="ppx:localVars"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="variables_infos"> + <xsl:with-param name="var_class"> + <xsl:text>Local</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:globalVars"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="variables_infos"> + <xsl:with-param name="var_class"> + <xsl:text>Global</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:externalVars"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="variables_infos"> + <xsl:with-param name="var_class"> + <xsl:text>External</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:tempVars"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="variables_infos"> + <xsl:with-param name="var_class"> + <xsl:text>Temp</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:inputVars"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="variables_infos"> + <xsl:with-param name="var_class"> + <xsl:text>Input</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:outputVars"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="variables_infos"> + <xsl:with-param name="var_class"> + <xsl:text>Output</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:inOutVars"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="variables_infos"> + <xsl:with-param name="var_class"> + <xsl:text>InOut</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:pou"> + <xsl:param name="_indent" select="0"/> + <xsl:apply-templates select="ppx:interface/*[self::ppx:inputVars or self::ppx:inOutVars or self::ppx:outputVars]/ppx:variable"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ppx:variable"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="name"> + <xsl:value-of select="@name"/> + </xsl:variable> + <xsl:value-of select="ns:AddTree($name)"/> + <xsl:apply-templates select="ppx:type"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:value-of select="ns:AddVarToTree($name)"/> + </xsl:template> + <xsl:template match="ppx:dataType"> + <xsl:param name="_indent" select="0"/> + <xsl:apply-templates select="ppx:baseType"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:struct"> + <xsl:param name="_indent" select="0"/> + <xsl:apply-templates select="ppx:variable"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="type_name"> + <xsl:value-of select="@name"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$tree='True'"> + <xsl:apply-templates select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:when> + </xsl:choose> + <xsl:value-of select="ns:SetType($type_name)"/> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:array"> + <xsl:param name="_indent" select="0"/> + <xsl:apply-templates select="ppx:baseType"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:for-each select="ppx:dimension"> + <xsl:value-of select="ns:AddDimension(@lower, @upper)"/> + </xsl:for-each> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="name"> + <xsl:text>STRING</xsl:text> + </xsl:variable> + <xsl:value-of select="ns:SetType($name)"/> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="name"> + <xsl:text>WSTRING</xsl:text> + </xsl:variable> + <xsl:value-of select="ns:SetType($name)"/> + </xsl:template> + <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="name"> + <xsl:value-of select="local-name()"/> + </xsl:variable> + <xsl:value-of select="ns:SetType($name)"/> + </xsl:template> + <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="type_name" select="@name"/> + <xsl:variable name="pou_infos"> + <xsl:copy-of select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$pou_infos != ''"> + <xsl:text>false</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>true</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*"> + <xsl:param name="_indent" select="0"/> + <xsl:text>true</xsl:text> + </xsl:template> + <xsl:template match="ppx:value"> + <xsl:param name="_indent" select="0"/> + <xsl:choose> + <xsl:when test="@repetitionValue"> + <xsl:value-of select="@repetitionValue"/> + <xsl:text>(</xsl:text> + <xsl:apply-templates> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:text>)</xsl:text> + </xsl:when> + <xsl:when test="@member"> + <xsl:value-of select="@member"/> + <xsl:text> := </xsl:text> + <xsl:apply-templates> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="ppx:simpleValue"> + <xsl:param name="_indent" select="0"/> + <xsl:value-of select="@value"/> + </xsl:template> + <xsl:template name="complex_type_value"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="start_bracket"/> + <xsl:param name="end_bracket"/> + <xsl:value-of select="@start_bracket"/> + <xsl:for-each select="ppx:value"> + <xsl:apply-templates select="."> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + </xsl:apply-templates> + <xsl:choose> + <xsl:when test="position()!=last()"> + <xsl:text>, </xsl:text> + </xsl:when> + </xsl:choose> + </xsl:for-each> + <xsl:value-of select="@end_bracket"/> + </xsl:template> + <xsl:template match="ppx:arrayValue"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="complex_type_value"> + <xsl:with-param name="start_bracket"> + <xsl:text>[</xsl:text> + </xsl:with-param> + <xsl:with-param name="end_bracket"> + <xsl:text>]</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="ppx:structValue"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="complex_type_value"> + <xsl:with-param name="start_bracket"> + <xsl:text>(</xsl:text> + </xsl:with-param> + <xsl:with-param name="end_bracket"> + <xsl:text>)</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> +</xsl:stylesheet>