Separate the XSY-flattening stylesheet into separate files for the dataBlock node and DDTSource nodes.
This commit is contained in:
33
formats/controlexpert/flatten_datablock.xslt
Normal file
33
formats/controlexpert/flatten_datablock.xslt
Normal file
@@ -0,0 +1,33 @@
|
||||
<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:output encoding="utf8" method="xml" omit-xml-declaration="no" indent="yes"/>
|
||||
<!-- <xsl:strip-space elements="*"/> -->
|
||||
|
||||
<xsl:template match="/VariablesExchangeFile">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="dataBlock"/>
|
||||
<xsl:apply-templates select="DDTSource"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dataBlock">
|
||||
<xsl:apply-templates select="variables"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="variables">
|
||||
<xsl:copy>
|
||||
<name><xsl:value-of select="@name"/></name>
|
||||
<parent/>
|
||||
<type><xsl:value-of select="@typeName"/></type>
|
||||
<address><xsl:value-of select="@topologicalAddress"/></address>
|
||||
<bitrank/>
|
||||
<save><xsl:value-of select="attribute/@Save"/></save>
|
||||
<comment><xsl:value-of select="../../comment"/>: <xsl:value-of select="comment"/></comment>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -14,26 +14,10 @@
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dataBlock">
|
||||
<xsl:apply-templates select="variables"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="DDTSource">
|
||||
<xsl:apply-templates select="structure/variables"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="variables">
|
||||
<xsl:copy>
|
||||
<name><xsl:value-of select="@name"/></name>
|
||||
<parent/>
|
||||
<type><xsl:value-of select="@typeName"/></type>
|
||||
<address><xsl:value-of select="@topologicalAddress"/></address>
|
||||
<bitrank/>
|
||||
<save><xsl:value-of select="attribute/@Save"/></save>
|
||||
<comment><xsl:value-of select="../../comment"/>: <xsl:value-of select="comment"/></comment>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="structure/variables">
|
||||
<xsl:copy>
|
||||
<name><xsl:value-of select="@name"/></name>
|
||||
Reference in New Issue
Block a user