plcopen/instances_path.xslt
author Laurent Bessard
Wed, 02 Oct 2013 01:21:35 +0200
changeset 1338 c1e6c712cc35
parent 1319 748347102c97
child 1350 7280349a3375
permissions -rw-r--r--
Replaced old graphic viewer blocks loading process by xslt stylesheet
1319
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     1
<xsl:stylesheet version="1.0"
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     2
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     3
    xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     4
    xmlns:ns="instances_ns"
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     5
    extension-element-prefixes="ns"
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     6
    exclude-result-prefixes="ns">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     7
  <xsl:param name="instance_type"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     8
  <xsl:template match="ppx:project">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
     9
   <instances>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    10
     <xsl:apply-templates select="ppx:instances/ppx:configurations/ppx:configuration"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    11
   </instances>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    12
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    13
  <xsl:template match="ppx:configuration">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    14
    <xsl:apply-templates select="ppx:globalVars/ppx:variable[ppx:type/ppx:derived]">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    15
      <xsl:with-param name="parent_path" select="@name"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    16
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    17
    <xsl:apply-templates select="ppx:resource">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    18
      <xsl:with-param name="parent_path" select="@name"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    19
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    20
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    21
  <xsl:template match="ppx:resource">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    22
    <xsl:param name="parent_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    23
    <xsl:variable name="resource_path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    24
      <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
    25
      <xsl:text>.</xsl:text>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    26
      <xsl:value-of select="@name"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    27
    </xsl:variable>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    28
    <xsl:apply-templates select="ppx:globalVars/ppx:variable[ppx:type/ppx:derived]">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    29
      <xsl:with-param name="parent_path" select="$resource_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    30
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    31
    <xsl:apply-templates select="ppx:pouInstance | ppx:task/ppx:pouInstance">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    32
      <xsl:with-param name="parent_path" select="$resource_path"/>
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">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    44
        <instance>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    45
          <xsl:attribute name="path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    46
            <xsl:value-of select="$pou_instance_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    47
          </xsl:attribute>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    48
        </instance>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    49
      </xsl:when>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    50
      <xsl:otherwise>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    51
        <ns:instance_definition>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    52
          <xsl:attribute name="name">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    53
            <xsl:value-of select="@typeName"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    54
          </xsl:attribute>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    55
          <xsl:attribute name="path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    56
            <xsl:value-of select="$pou_instance_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    57
          </xsl:attribute>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    58
        </ns:instance_definition>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    59
      </xsl:otherwise>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    60
    </xsl:choose>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    61
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    62
  <xsl:template match="ppx:pou">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    63
    <xsl:param name="instance_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    64
    <xsl:apply-templates select="ppx:interface/*/ppx:variable[ppx:type/ppx:derived]">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    65
      <xsl:with-param name="parent_path" select="$instance_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    66
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    67
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    68
  <xsl:template match="ppx:dataType">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    69
    <xsl:param name="instance_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    70
    <xsl:apply-templates select="ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    71
      <xsl:with-param name="parent_path" select="$instance_path"/>
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">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    82
      <xsl:with-param name="variable_path" select="$variable_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    83
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    84
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    85
  <xsl:template match="ppx:derived">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    86
    <xsl:param name="variable_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    87
    <xsl:choose>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    88
      <xsl:when test="@name=$instance_type">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    89
        <instance>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    90
          <xsl:attribute name="path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    91
            <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
    92
          </xsl:attribute>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    93
        </instance>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    94
      </xsl:when>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    95
      <xsl:otherwise>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    96
        <ns:instance_definition>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    97
          <xsl:attribute name="name">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    98
            <xsl:value-of select="@name"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
    99
          </xsl:attribute>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   100
          <xsl:attribute name="path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   101
            <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
   102
          </xsl:attribute>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   103
        </ns:instance_definition>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   104
      </xsl:otherwise>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   105
    </xsl:choose>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   106
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   107
  <xsl:template name="ppx:struct">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   108
    <xsl:param name="variable_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   109
    <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
   110
      <xsl:variable name="element_path">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   111
        <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
   112
        <xsl:text>.</xsl:text>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   113
        <xsl:value-of select="@name"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   114
      </xsl:variable>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   115
      <xsl:apply-templates select="ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   116
        <xsl:with-param name="variable_path" select="$element_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   117
      </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   118
    </xsl:for-each>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   119
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   120
  <xsl:template name="ppx:array">
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]">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   123
      <xsl:with-param name="variable_path" select="$variable_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   124
    </xsl:apply-templates> 
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   125
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   126
  <xsl:template match="pou_instance">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   127
    <xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   128
      <xsl:with-param name="instance_path" select="@pou_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   129
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   130
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   131
  <xsl:template match="datatype_instance">
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   132
    <xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   133
      <xsl:with-param name="instance_path" select="@datatype_path"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   134
    </xsl:apply-templates>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   135
  </xsl:template>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   136
  <xsl:template match="text()"/>
748347102c97 Replaced old list of pou instance in project generating process by xslt stylesheet
Laurent Bessard
parents:
diff changeset
   137
</xsl:stylesheet>