Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 07:10 AM
Petterson Mikael
Guest
 
Posts: n/a
Default How to find a matching element in xml with xsl

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">
<xsl:param 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>
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles