plcopen/variables_infos.xslt
changeset 1951 bbd1e1744c91
parent 1936 b85b13b1c2ec
child 2637 507737ec2b9a
equal deleted inserted replaced
1950:752ec68da94d 1951:bbd1e1744c91
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2 <xsl:stylesheet xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:ns="var_infos_ns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="ns" version="1.0" exclude-result-prefixes="ns">
     2 <xsl:stylesheet xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:ns="beremiz" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="ns" version="1.0" exclude-result-prefixes="ns">
     3   <xsl:output method="xml"/>
     3   <xsl:output method="xml"/>
     4   <xsl:param name="tree"/>
     4   <xsl:param name="tree"/>
     5   <xsl:template match="text()"/>
     5   <xsl:template match="text()"/>
     6   <xsl:variable name="project">
     6   <xsl:variable name="project" select="ns:GetProject()"/>
     7     <xsl:copy-of select="document('project')/project/*"/>
     7   <xsl:variable name="stdlib" select="ns:GetStdLibs()"/>
     8   </xsl:variable>
     8   <xsl:variable name="extensions" select="ns:GetExtensions()"/>
     9   <xsl:variable name="stdlib">
     9   <xsl:variable name="all_types" select="($project | $stdlib | $extensions)/ppx:types"/>
    10     <xsl:copy-of select="document('stdlib')/stdlib/*"/>
       
    11   </xsl:variable>
       
    12   <xsl:variable name="extensions">
       
    13     <xsl:copy-of select="document('extensions')/extensions/*"/>
       
    14   </xsl:variable>
       
    15   <xsl:template match="ppx:configuration">
    10   <xsl:template match="ppx:configuration">
    16     <xsl:apply-templates select="ppx:globalVars"/>
    11     <xsl:apply-templates select="ppx:globalVars"/>
    17   </xsl:template>
    12   </xsl:template>
    18   <xsl:template match="ppx:resource">
    13   <xsl:template match="ppx:resource">
    19     <xsl:apply-templates select="ppx:globalVars"/>
    14     <xsl:apply-templates select="ppx:globalVars"/>
   129     <xsl:variable name="type_name">
   124     <xsl:variable name="type_name">
   130       <xsl:value-of select="@name"/>
   125       <xsl:value-of select="@name"/>
   131     </xsl:variable>
   126     </xsl:variable>
   132     <xsl:choose>
   127     <xsl:choose>
   133       <xsl:when test="$tree='True'">
   128       <xsl:when test="$tree='True'">
   134         <xsl:apply-templates mode="var_type" select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |&#10;                         exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] |&#10;                         exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |&#10;                         exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] |&#10;                         exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |&#10;                         exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]"/>
   129         <xsl:apply-templates mode="var_type" select="$all_types/ppx:pous/ppx:pou[@name=$type_name] |                          $all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]"/>
   135       </xsl:when>
   130       </xsl:when>
   136     </xsl:choose>
   131     </xsl:choose>
   137     <xsl:value-of select="ns:SetType($type_name)"/>
   132     <xsl:value-of select="ns:SetType($type_name)"/>
   138   </xsl:template>
   133   </xsl:template>
   139   <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:array">
   134   <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:array">
   168   </xsl:template>
   163   </xsl:template>
   169   <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived">
   164   <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived">
   170     <xsl:variable name="type_name">
   165     <xsl:variable name="type_name">
   171       <xsl:value-of select="@name"/>
   166       <xsl:value-of select="@name"/>
   172     </xsl:variable>
   167     </xsl:variable>
   173     <xsl:variable name="pou_infos">
   168     <xsl:variable name="pou_infos" select="$all_types/ppx:pous/ppx:pou[@name=$type_name]"/>
   174       <xsl:copy-of select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |&#10;                    exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |&#10;                    exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/>
       
   175     </xsl:variable>
       
   176     <xsl:choose>
   169     <xsl:choose>
   177       <xsl:when test="$pou_infos != ''">
   170       <xsl:when test="$pou_infos != ''">
   178         <xsl:text>false</xsl:text>
   171         <xsl:text>false</xsl:text>
   179       </xsl:when>
   172       </xsl:when>
   180       <xsl:otherwise>
   173       <xsl:otherwise>