Laurent@1351: <?xml version="1.0"?> Edouard@2637: <xsl:stylesheet xmlns:ns="beremiz" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:exsl="http://exslt.org/common" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="ns" extension-element-prefixes="ns"> Laurent@1351: <xsl:output method="xml"/> Laurent@1321: <xsl:param name="instance_path"/> Edouard@1950: <xsl:variable name="project" select="ns:GetProject()"/> Edouard@1950: <xsl:variable name="stdlib" select="ns:GetStdLibs()"/> Edouard@1950: <xsl:variable name="extensions" select="ns:GetExtensions()"/> Edouard@1950: <xsl:variable name="all_types" select="($project | $stdlib | $extensions)/ppx:types"/> Laurent@1321: <xsl:template name="element_name"> Laurent@1321: <xsl:param name="path"/> Laurent@1321: <xsl:choose> Laurent@1321: <xsl:when test="contains($path,'.')"> Laurent@1321: <xsl:value-of select="substring-before($path,'.')"/> Laurent@1321: </xsl:when> Laurent@1321: <xsl:otherwise> Laurent@1321: <xsl:value-of select="$path"/> Laurent@1321: </xsl:otherwise> Laurent@1321: </xsl:choose> Laurent@1321: </xsl:template> Laurent@1321: <xsl:template name="next_path"> Laurent@1321: <xsl:param name="path"/> Laurent@1321: <xsl:choose> Laurent@1321: <xsl:when test="contains($path,'.')"> Laurent@1321: <xsl:value-of select="substring-after($path,'.')"/> Laurent@1321: </xsl:when> Laurent@1321: </xsl:choose> Laurent@1321: </xsl:template> Laurent@1321: <xsl:template match="ppx:project"> Laurent@1321: <xsl:variable name="config_name"> Laurent@1321: <xsl:call-template name="element_name"> Laurent@1321: <xsl:with-param name="path" select="$instance_path"/> Laurent@1321: </xsl:call-template> Laurent@1321: </xsl:variable> Laurent@1321: <xsl:apply-templates select="ppx:instances/ppx:configurations/ppx:configuration[@name=$config_name]"> Laurent@1321: <xsl:with-param name="element_path"> Laurent@1321: <xsl:call-template name="next_path"> Laurent@1321: <xsl:with-param name="path" select="$instance_path"/> Laurent@1321: </xsl:call-template> Laurent@1321: </xsl:with-param> Laurent@1321: </xsl:apply-templates> Laurent@1321: </xsl:template> Laurent@1321: <xsl:template match="ppx:configuration"> Laurent@1321: <xsl:param name="element_path"/> Laurent@1321: <xsl:choose> Laurent@1321: <xsl:when test="$element_path!=''"> Laurent@1321: <xsl:variable name="child_name"> Laurent@1351: <xsl:call-template name="element_name"> Laurent@1351: <xsl:with-param name="path" select="$element_path"/> Laurent@1351: </xsl:call-template> Laurent@1351: </xsl:variable> Laurent@1321: <xsl:apply-templates select="ppx:resource[@name=$child_name] | ppx:globalVars/ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]"> Laurent@1321: <xsl:with-param name="element_path"> Laurent@1321: <xsl:call-template name="next_path"> Laurent@1321: <xsl:with-param name="path" select="$element_path"/> Laurent@1321: </xsl:call-template> Laurent@1321: </xsl:with-param> Laurent@1321: </xsl:apply-templates> Laurent@1321: </xsl:when> Laurent@1321: <xsl:otherwise> Laurent@1351: <xsl:value-of select="ns:ConfigTagName(@name)"/> Laurent@1351: </xsl:otherwise> Laurent@1351: </xsl:choose> Laurent@1351: </xsl:template> Laurent@1351: <xsl:template match="ppx:resource"> Laurent@1351: <xsl:param name="element_path"/> Laurent@1351: <xsl:choose> Laurent@1351: <xsl:when test="$element_path!=''"> Laurent@1351: <xsl:variable name="child_name"> Laurent@1351: <xsl:call-template name="element_name"> Laurent@1351: <xsl:with-param name="path"> Laurent@1351: <xsl:value-of select="$element_path"/> Laurent@1351: </xsl:with-param> Laurent@1351: </xsl:call-template> Laurent@1351: </xsl:variable> Laurent@1351: <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]"> Laurent@1351: <xsl:with-param name="element_path"> Laurent@1351: <xsl:call-template name="next_path"> Laurent@1351: <xsl:with-param name="path" select="$element_path"/> Laurent@1351: </xsl:call-template> Laurent@1351: </xsl:with-param> Laurent@1351: </xsl:apply-templates> Laurent@1351: </xsl:when> Laurent@1351: <xsl:otherwise> Laurent@1351: <xsl:value-of select="ns:ResourceTagName(ancestor::ppx:configuration/@name, @name)"/> Laurent@1321: </xsl:otherwise> Laurent@1321: </xsl:choose> Laurent@1321: </xsl:template> Laurent@1321: <xsl:template match="ppx:pouInstance"> Laurent@1321: <xsl:param name="element_path"/> Laurent@1351: <xsl:variable name="type_name"> Laurent@1351: <xsl:value-of select="@typeName"/> Laurent@1351: </xsl:variable> Edouard@1950: <xsl:apply-templates select="$all_types/ppx:pous/ppx:pou[@name=$type_name] | $all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]"> Laurent@1351: <xsl:with-param name="element_path" select="$element_path"/> Laurent@1351: </xsl:apply-templates> Laurent@1321: </xsl:template> Laurent@1321: <xsl:template match="ppx:pou"> Laurent@1351: <xsl:param name="element_path"/> Laurent@1351: <xsl:choose> Laurent@1351: <xsl:when test="$element_path!=''"> Laurent@1351: <xsl:variable name="child_name"> Laurent@1351: <xsl:call-template name="element_name"> Laurent@1351: <xsl:with-param name="path" select="$element_path"/> Laurent@1351: </xsl:call-template> Laurent@1351: </xsl:variable> Laurent@1351: <xsl:apply-templates select="ppx:interface/*/ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]"> Laurent@1351: <xsl:with-param name="element_path"> Laurent@1351: <xsl:call-template name="next_path"> Laurent@1351: <xsl:with-param name="path" select="$element_path"/> Laurent@1351: </xsl:call-template> Laurent@1351: </xsl:with-param> Laurent@1351: </xsl:apply-templates> edouard@1936: <xsl:apply-templates select="ppx:actions/ppx:action[@name=$child_name] | ppx:transitions/ppx:transition[@name=$child_name]"/> Laurent@1351: </xsl:when> Laurent@1351: <xsl:otherwise> Laurent@1351: <xsl:variable name="name"> Laurent@1351: <xsl:value-of select="@name"/> Laurent@1351: </xsl:variable> Laurent@1351: <xsl:value-of select="ns:PouTagName($name)"/> Laurent@1351: </xsl:otherwise> Laurent@1351: </xsl:choose> Laurent@1351: </xsl:template> Laurent@1351: <xsl:template match="ppx:action"> Laurent@1351: <xsl:value-of select="ns:ActionTagName(ancestor::ppx:pou/@name, @name)"/> Laurent@1351: </xsl:template> Laurent@1351: <xsl:template match="ppx:transition"> Laurent@1351: <xsl:value-of select="ns:TransitionTagName(ancestor::ppx:pou/@name, @name)"/> Laurent@1351: </xsl:template> Laurent@1351: <xsl:template match="ppx:dataType"> Laurent@1351: <xsl:param name="element_path"/> Laurent@1351: <xsl:apply-templates select="ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]"> Laurent@1351: <xsl:with-param name="element_path" select="$element_path"/> Laurent@1351: </xsl:apply-templates> Laurent@1351: </xsl:template> Laurent@1351: <xsl:template match="ppx:derived"> Laurent@1351: <xsl:param name="element_path"/> Laurent@1351: <xsl:variable name="type_name"> Laurent@1351: <xsl:value-of select="@name"/> Laurent@1351: </xsl:variable> Edouard@1950: <xsl:apply-templates select="$all_types/ppx:pous/ppx:pou[@name=$type_name] | $all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]"> Laurent@1351: <xsl:with-param name="element_path" select="$element_path"/> Laurent@1351: </xsl:apply-templates> Laurent@1351: </xsl:template> Laurent@1351: <xsl:template match="ppx:array"> Laurent@1351: <xsl:param name="element_path"/> Laurent@1351: <xsl:apply-templates select="ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]"> Laurent@1351: <xsl:with-param name="element_path" select="$element_path"/> Laurent@1351: </xsl:apply-templates> Laurent@1351: </xsl:template> Laurent@1351: <xsl:template match="ppx:struct"> Laurent@1321: <xsl:param name="element_path"/> Laurent@1321: <xsl:variable name="child_name"> Laurent@1321: <xsl:call-template name="element_name"> Laurent@1321: <xsl:with-param name="path" select="$element_path"/> Laurent@1321: </xsl:call-template> Laurent@1321: </xsl:variable> Laurent@1351: <xsl:apply-templates select="ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]"> Laurent@1326: <xsl:with-param name="element_path"> Laurent@1326: <xsl:call-template name="next_path"> Laurent@1326: <xsl:with-param name="path" select="$element_path"/> Laurent@1326: </xsl:call-template> Laurent@1326: </xsl:with-param> Laurent@1326: </xsl:apply-templates> Laurent@1321: </xsl:template> Laurent@1351: </xsl:stylesheet>