Laurent@1350: <?xml version="1.0"?> Laurent@1350: <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="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"> Laurent@1350: <xsl:output method="xml"/> Laurent@1350: <xsl:variable name="space" select="' '"/> Laurent@1350: <xsl:param name="autoindent" select="4"/> Laurent@1319: <xsl:param name="instance_type"/> Laurent@1350: <xsl:template match="text()"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1350: </xsl:template> Laurent@1350: <xsl:variable name="project"> Laurent@1350: <xsl:copy-of select="document('project')/project/*"/> Laurent@1350: </xsl:variable> Laurent@1350: <xsl:variable name="stdlib"> Laurent@1350: <xsl:copy-of select="document('stdlib')/stdlib/*"/> Laurent@1350: </xsl:variable> Laurent@1350: <xsl:variable name="extensions"> Laurent@1350: <xsl:copy-of select="document('extensions')/extensions/*"/> Laurent@1350: </xsl:variable> Laurent@1319: <xsl:template match="ppx:project"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1350: <instances> Laurent@1350: <xsl:apply-templates select="ppx:instances/ppx:configurations/ppx:configuration"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: </xsl:apply-templates> Laurent@1350: </instances> Laurent@1319: </xsl:template> Laurent@1319: <xsl:template match="ppx:configuration"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1350: <xsl:apply-templates select="ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:resource"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: <xsl:with-param name="parent_path"> Laurent@1350: <xsl:value-of select="@name"/> Laurent@1350: </xsl:with-param> Laurent@1319: </xsl:apply-templates> Laurent@1319: </xsl:template> Laurent@1319: <xsl:template match="ppx:resource"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1319: <xsl:param name="parent_path"/> Laurent@1319: <xsl:variable name="resource_path"> Laurent@1319: <xsl:value-of select="$parent_path"/> Laurent@1319: <xsl:text>.</xsl:text> Laurent@1319: <xsl:value-of select="@name"/> Laurent@1319: </xsl:variable> Laurent@1350: <xsl:apply-templates select="ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:pouInstance | ppx:task/ppx:pouInstance"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: <xsl:with-param name="parent_path"> Laurent@1350: <xsl:value-of select="$resource_path"/> Laurent@1350: </xsl:with-param> Laurent@1319: </xsl:apply-templates> Laurent@1319: </xsl:template> Laurent@1319: <xsl:template match="ppx:pouInstance"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1319: <xsl:param name="parent_path"/> Laurent@1319: <xsl:variable name="pou_instance_path"> Laurent@1319: <xsl:value-of select="$parent_path"/> Laurent@1319: <xsl:text>.</xsl:text> Laurent@1319: <xsl:value-of select="@name"/> Laurent@1319: </xsl:variable> Laurent@1319: <xsl:choose> Laurent@1319: <xsl:when test="@typeName=$instance_type"> Laurent@1350: <xsl:value-of select="ns:AddInstance($pou_instance_path)"/> Laurent@1319: </xsl:when> Laurent@1319: <xsl:otherwise> Laurent@1350: <xsl:variable name="type_name"> Laurent@1350: <xsl:value-of select="@typeName"/> Laurent@1350: </xsl:variable> Laurent@1350: <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]"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: <xsl:with-param name="instance_path"> Laurent@1319: <xsl:value-of select="$pou_instance_path"/> Laurent@1350: </xsl:with-param> Laurent@1350: </xsl:apply-templates> Laurent@1319: </xsl:otherwise> Laurent@1319: </xsl:choose> Laurent@1319: </xsl:template> Laurent@1319: <xsl:template match="ppx:pou"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1319: <xsl:param name="instance_path"/> Laurent@1319: <xsl:apply-templates select="ppx:interface/*/ppx:variable[ppx:type/ppx:derived]"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: <xsl:with-param name="parent_path"> Laurent@1350: <xsl:value-of select="$instance_path"/> Laurent@1350: </xsl:with-param> Laurent@1319: </xsl:apply-templates> Laurent@1319: </xsl:template> Laurent@1319: <xsl:template match="ppx:dataType"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1319: <xsl:param name="instance_path"/> Laurent@1319: <xsl:apply-templates select="ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: <xsl:with-param name="parent_path"> Laurent@1350: <xsl:value-of select="$instance_path"/> Laurent@1350: </xsl:with-param> Laurent@1319: </xsl:apply-templates> Laurent@1319: </xsl:template> Laurent@1319: <xsl:template match="ppx:variable"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1319: <xsl:param name="parent_path"/> Laurent@1319: <xsl:variable name="variable_path"> Laurent@1319: <xsl:value-of select="$parent_path"/> Laurent@1319: <xsl:text>.</xsl:text> Laurent@1319: <xsl:value-of select="@name"/> Laurent@1319: </xsl:variable> Laurent@1319: <xsl:apply-templates select="ppx:type/ppx:derived"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: <xsl:with-param name="variable_path"> Laurent@1350: <xsl:value-of select="$variable_path"/> Laurent@1350: </xsl:with-param> Laurent@1319: </xsl:apply-templates> Laurent@1319: </xsl:template> Laurent@1319: <xsl:template match="ppx:derived"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1319: <xsl:param name="variable_path"/> Laurent@1319: <xsl:choose> Laurent@1319: <xsl:when test="@name=$instance_type"> Laurent@1350: <xsl:value-of select="ns:AddInstance($variable_path)"/> Laurent@1319: </xsl:when> Laurent@1319: <xsl:otherwise> Laurent@1350: <xsl:variable name="type_name"> Laurent@1350: <xsl:value-of select="@name"/> Laurent@1350: </xsl:variable> Laurent@1350: <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]"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: <xsl:with-param name="instance_path"> Laurent@1319: <xsl:value-of select="$variable_path"/> Laurent@1350: </xsl:with-param> Laurent@1350: </xsl:apply-templates> Laurent@1319: </xsl:otherwise> Laurent@1319: </xsl:choose> Laurent@1319: </xsl:template> Laurent@1350: <xsl:template match="ppx:struct"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1319: <xsl:param name="variable_path"/> Laurent@1319: <xsl:for-each select="ppx:variable[ppx:type/ppx:derived or ppx:type/ppx:struct or ppx:type/ppx:array]"> Laurent@1319: <xsl:variable name="element_path"> Laurent@1319: <xsl:value-of select="$variable_path"/> Laurent@1319: <xsl:text>.</xsl:text> Laurent@1319: <xsl:value-of select="@name"/> Laurent@1319: </xsl:variable> Laurent@1319: </xsl:for-each> Laurent@1350: <xsl:apply-templates select="ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: <xsl:with-param name="variable_path"> Laurent@1350: <xsl:value-of select="$element_path"/> Laurent@1350: </xsl:with-param> Laurent@1350: </xsl:apply-templates> Laurent@1319: </xsl:template> Laurent@1350: <xsl:template match="ppx:array"> Laurent@1350: <xsl:param name="_indent" select="0"/> Laurent@1319: <xsl:param name="variable_path"/> Laurent@1319: <xsl:apply-templates select="ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]"> Laurent@1350: <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> Laurent@1350: <xsl:with-param name="variable_path"> Laurent@1350: <xsl:value-of select="$variable_path"/> Laurent@1350: </xsl:with-param> Laurent@1350: </xsl:apply-templates> Laurent@1319: </xsl:template> Laurent@1350: </xsl:stylesheet>