plcopen/instances_path.xslt
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 16 Feb 2018 02:29:10 +0100
changeset 1937 986dbad48ab7
parent 1936 b85b13b1c2ec
child 1938 87136f8697e3
permissions -rw-r--r--
This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
     1
<?xml version="1.0"?>
1936
b85b13b1c2ec YSLT auto indent trick is useless here, added yslt_noindent.yml2, regenerated XSLT files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1352
diff changeset
     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="instances_ns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="ns" version="1.0" exclude-result-prefixes="ns">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
     3
  <xsl:output method="xml"/>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     4
  <xsl:param name="instance_type"/>
1936
b85b13b1c2ec YSLT auto indent trick is useless here, added yslt_noindent.yml2, regenerated XSLT files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1352
diff changeset
     5
  <xsl:template match="text()"/>
1937
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
     6
  <xsl:variable name="project" select="ns:GetProject()"/>
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
     7
  <xsl:variable name="stdlib" select="ns:GetStdLibs()"/>
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
     8
  <xsl:variable name="extensions" select="ns:GetExtensions()"/>
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
     9
  <xsl:variable name="all" select="$project | $stdlib | $extensions"/>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    10
  <xsl:template match="ppx:project">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    11
    <instances>
1936
b85b13b1c2ec YSLT auto indent trick is useless here, added yslt_noindent.yml2, regenerated XSLT files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1352
diff changeset
    12
      <xsl:apply-templates select="ppx:instances/ppx:configurations/ppx:configuration"/>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    13
    </instances>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    14
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    15
  <xsl:template match="ppx:configuration">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    16
    <xsl:apply-templates select="ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:resource">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    17
      <xsl:with-param name="parent_path">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    18
        <xsl:value-of select="@name"/>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    19
      </xsl:with-param>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    20
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    21
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    22
  <xsl:template match="ppx:resource">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    23
    <xsl:param name="parent_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    24
    <xsl:variable name="resource_path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    25
      <xsl:value-of select="$parent_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    26
      <xsl:text>.</xsl:text>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    27
      <xsl:value-of select="@name"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    28
    </xsl:variable>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    29
    <xsl:apply-templates select="ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:pouInstance | ppx:task/ppx:pouInstance">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    30
      <xsl:with-param name="parent_path">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    31
        <xsl:value-of select="$resource_path"/>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    32
      </xsl:with-param>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    33
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    34
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    35
  <xsl:template match="ppx:pouInstance">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    36
    <xsl:param name="parent_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    37
    <xsl:variable name="pou_instance_path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    38
      <xsl:value-of select="$parent_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    39
      <xsl:text>.</xsl:text>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    40
      <xsl:value-of select="@name"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    41
    </xsl:variable>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    42
    <xsl:choose>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    43
      <xsl:when test="@typeName=$instance_type">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    44
        <xsl:value-of select="ns:AddInstance($pou_instance_path)"/>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    45
      </xsl:when>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    46
      <xsl:otherwise>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    47
        <xsl:variable name="type_name">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    48
          <xsl:value-of select="@typeName"/>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    49
        </xsl:variable>
1937
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
    50
        <xsl:apply-templates select="$all/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |&#10;                         $all/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    51
          <xsl:with-param name="instance_path">
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    52
            <xsl:value-of select="$pou_instance_path"/>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    53
          </xsl:with-param>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    54
        </xsl:apply-templates>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    55
      </xsl:otherwise>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    56
    </xsl:choose>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    57
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    58
  <xsl:template match="ppx:pou">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    59
    <xsl:param name="instance_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    60
    <xsl:apply-templates select="ppx:interface/*/ppx:variable[ppx:type/ppx:derived]">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    61
      <xsl:with-param name="parent_path">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    62
        <xsl:value-of select="$instance_path"/>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    63
      </xsl:with-param>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    64
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    65
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    66
  <xsl:template match="ppx:dataType">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    67
    <xsl:param name="instance_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    68
    <xsl:apply-templates select="ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    69
      <xsl:with-param name="parent_path">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    70
        <xsl:value-of select="$instance_path"/>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    71
      </xsl:with-param>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    72
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    73
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    74
  <xsl:template match="ppx:variable">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    75
    <xsl:param name="parent_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    76
    <xsl:variable name="variable_path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    77
      <xsl:value-of select="$parent_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    78
      <xsl:text>.</xsl:text>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    79
      <xsl:value-of select="@name"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    80
    </xsl:variable>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    81
    <xsl:apply-templates select="ppx:type/ppx:derived">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    82
      <xsl:with-param name="variable_path">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    83
        <xsl:value-of select="$variable_path"/>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    84
      </xsl:with-param>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    85
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    86
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    87
  <xsl:template match="ppx:derived">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    88
    <xsl:param name="variable_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    89
    <xsl:choose>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    90
      <xsl:when test="@name=$instance_type">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    91
        <xsl:value-of select="ns:AddInstance($variable_path)"/>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    92
      </xsl:when>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    93
      <xsl:otherwise>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    94
        <xsl:variable name="type_name">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    95
          <xsl:value-of select="@name"/>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    96
        </xsl:variable>
1937
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
    97
        <xsl:apply-templates select="$all/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |&#10;                         $all/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
    98
          <xsl:with-param name="instance_path">
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    99
            <xsl:value-of select="$variable_path"/>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   100
          </xsl:with-param>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   101
        </xsl:apply-templates>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   102
      </xsl:otherwise>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   103
    </xsl:choose>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   104
  </xsl:template>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   105
  <xsl:template match="ppx:struct">
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   106
    <xsl:param name="variable_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   107
    <xsl:for-each select="ppx:variable[ppx:type/ppx:derived or ppx:type/ppx:struct or ppx:type/ppx:array]">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   108
      <xsl:variable name="element_path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   109
        <xsl:value-of select="$variable_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   110
        <xsl:text>.</xsl:text>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   111
        <xsl:value-of select="@name"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   112
      </xsl:variable>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   113
    </xsl:for-each>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   114
    <xsl:apply-templates select="ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   115
      <xsl:with-param name="variable_path">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   116
        <xsl:value-of select="$element_path"/>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   117
      </xsl:with-param>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   118
    </xsl:apply-templates>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   119
  </xsl:template>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   120
  <xsl:template match="ppx:array">
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   121
    <xsl:param name="variable_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   122
    <xsl:apply-templates select="ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   123
      <xsl:with-param name="variable_path">
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   124
        <xsl:value-of select="$variable_path"/>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   125
      </xsl:with-param>
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   126
    </xsl:apply-templates>
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   127
  </xsl:template>
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents: 1319
diff changeset
   128
</xsl:stylesheet>