P
Petterson Mikael
Hi,
I have managed to get the name of the enum e.g. TxDeviceGroup_BbBusState
in the first part of the xml in the class element.
Now I need to find the minimum value of the enum called
TxDeviceGroup_BbBusState in the xml.
This is an operation I need to do for many enums.
I thought of doing something like this:
<xsl:call-template name="enumMin">
<xsl:with-param name="str"
select="enumRef/@name"/></xsl:call-template>
<!-- Now str have the value "TxDeviceGroup_BbBusState"
Then search the xml document for the enum, TxDeviceGroup_BbBusState
-->
<xsl:template name="enumMin">
<xslaram name="str"/>
<xsl:if test="//enum/@name=$str">
<!-- Here i need to find the <enumMember> with <value> 0 ( or lowest)
and retrieve the
attribute name of <enumMember> -->
</xsl:if>
</xsl:template>
I appreciate all hints I could get.
//Mikael
My xml-file:
============
<class name="TxDeviceGroup">
<description>Device group for the Transmitter.
</description>
<attribute name="bbBusState">
<description>
</description>
<noNotification/>
<nonPersistent/>
<readOnly/>
<dataType>
<enumRef name="TxDeviceGroup_BbBusState">
<defaultValue>BUS_DISABLED</defaultValue>
</enumRef>
</dataType>
</attribute>
.........
<enum name="TxDeviceGroup_BbBusState">
<description></description>
<enumMember name="MASTER_LOADSHARING">
<value>0</value>
</enumMember>
<enumMember name="MASTER_NO_LOADSHARING">
<value>1</value>
</enumMember>
<enumMember name="SLAVE">
<value>2</value>
</enumMember>
<enumMember name="BUS_DISABLED">
<value>3</value>
</enumMember>
</enum>
I have managed to get the name of the enum e.g. TxDeviceGroup_BbBusState
in the first part of the xml in the class element.
Now I need to find the minimum value of the enum called
TxDeviceGroup_BbBusState in the xml.
This is an operation I need to do for many enums.
I thought of doing something like this:
<xsl:call-template name="enumMin">
<xsl:with-param name="str"
select="enumRef/@name"/></xsl:call-template>
<!-- Now str have the value "TxDeviceGroup_BbBusState"
Then search the xml document for the enum, TxDeviceGroup_BbBusState
-->
<xsl:template name="enumMin">
<xslaram name="str"/>
<xsl:if test="//enum/@name=$str">
<!-- Here i need to find the <enumMember> with <value> 0 ( or lowest)
and retrieve the
attribute name of <enumMember> -->
</xsl:if>
</xsl:template>
I appreciate all hints I could get.
//Mikael
My xml-file:
============
<class name="TxDeviceGroup">
<description>Device group for the Transmitter.
</description>
<attribute name="bbBusState">
<description>
</description>
<noNotification/>
<nonPersistent/>
<readOnly/>
<dataType>
<enumRef name="TxDeviceGroup_BbBusState">
<defaultValue>BUS_DISABLED</defaultValue>
</enumRef>
</dataType>
</attribute>
.........
<enum name="TxDeviceGroup_BbBusState">
<description></description>
<enumMember name="MASTER_LOADSHARING">
<value>0</value>
</enumMember>
<enumMember name="MASTER_NO_LOADSHARING">
<value>1</value>
</enumMember>
<enumMember name="SLAVE">
<value>2</value>
</enumMember>
<enumMember name="BUS_DISABLED">
<value>3</value>
</enumMember>
</enum>