58 lines
1.9 KiB
HTML
58 lines
1.9 KiB
HTML
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
<!--
|
|
Flatten a ControlExpert XSY file so that it can be read by pandas.
|
|
|
|
Copyright 2026 Prime Controls. All rights reserved.
|
|
-->
|
|
|
|
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
|
|
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
|
|
|
|
<xsl:output encoding="utf8" method="xml" omit-xml-declaration="no" indent="yes" />
|
|
|
|
<xsl:template match="/VariablesExchangeFile">
|
|
<xsl:copy>
|
|
<xsl:apply-templates select="DDTSource" />
|
|
<xsl:apply-templates select="FBSource" />
|
|
</xsl:copy>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="DDTSource">
|
|
<xsl:apply-templates select="structure/variables" />
|
|
</xsl:template>
|
|
|
|
<xsl:template match="structure/variables">
|
|
<xsl:copy>
|
|
<tagname>
|
|
<xsl:value-of select="@name" />
|
|
</tagname>
|
|
<type>
|
|
<xsl:value-of select="translate(@typeName, $lowercase, $uppercase)" />
|
|
</type>
|
|
<address />
|
|
<comment><xsl:value-of select="../../comment" />: <xsl:value-of select="comment" /></comment>
|
|
<parent>
|
|
<xsl:value-of select="translate(../../@DDTName, $lowercase, $uppercase)" />
|
|
</parent>
|
|
<bitrank>
|
|
<xsl:for-each select="attribute">
|
|
<xsl:if test="@name='ExtractBit'">
|
|
<xsl:value-of select="@value" />
|
|
</xsl:if>
|
|
</xsl:for-each>
|
|
</bitrank>
|
|
<save />
|
|
</xsl:copy>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="FBSource">
|
|
<xsl:copy>
|
|
<name>NULL</name>
|
|
<parent>
|
|
<xsl:value-of select="translate(@nameOfFBType, $lowercase, $uppercase)" />
|
|
</parent>
|
|
<type>DFB</type>
|
|
</xsl:copy>
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet> |