[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: String comparisons

Subject: RE: String comparisons
From: "Satish, L. Gnanendra" <LGnanendra.Satish@xxxxxxxxxx>
Date: Mon, 23 Sep 2002 09:20:32 +0200
xsl string comparisons
Hello,
 I have a problem with string comparisons.

The sample XML is:
<Message>
 <MessageInfo ID="1">
   <Name>Msg1</Name>
 </MessageInfo>
 <MessageInfo ID="2">
   <Name>Msg2</Name>
 </MessageInfo>
<Message>

<Behaviour>
 <BehaviourInfo ID="1">
	<Trap><Name>Trap1</Name></Trap>
	<Message>
         <Name>Msg1</Name>
         <MessageLevel>Major</MessageLevel>
      </Message>
 </BehaviourInfo>
 <BehaviourInfo ID="2">
	<Trap><Name>Trap2</Name></Trap>
	<Message>
         <Name>Msg2</Name>
         <MessageLevel>Minor</MessageLevel>
      </Message>
 </BehaviourInfo>
 <BehaviourInfo ID="3">
	<Trap><Name>Trap3</Name></Trap>
	<Message>
         <Name>Msg1</Name>
         <MessageLevel>Cleared</MessageLevel>
      </Message>
 </BehaviourInfo>
 <BehaviourInfo ID="4">
	<Trap><Name>Trap4</Name></Trap>
	<Message>
         <Name>Msg1</Name>
         <MessageLevel>Critical</MessageLevel>
      </Message>
 </BehaviourInfo>
 <BehaviourInfo ID="5">
	<Trap><Name>Trap5</Name></Trap>
	<Message>
         <Name>Msg2</Name>
         <MessageLevel>Cleared</MessageLevel>
      </Message>
 </BehaviourInfo>
</Behaviour>

I would like an HTML output like:
"An alarm messge<Msg1> is triggered by the traps 'trap1, trap4' and will be
cleared when the trap 'trap3' comes in."
"An alarm messge<Msg2> is triggered by the trap 'trap2' and will be
cleared when the trap 'trap5' comes in."

 The following templates are called from within another
template(Message-MessageInfo). I have to find a matching message in the
"behaviour" section and compare the 'cleared' string in this section. If it
is not cleared, it is the clearing alarm(s) else it is a triggering
alarm(s).
 The second template call works fine, but the ...TriggerTraps template call
doesn't. What could be the hitch? help needed asap.
 
<xsl:template name="Call_MsgClearedBySystemFindTriggerTraps">
    <xsl:variable name="MsgName" select="Name"/> --
(Message-MessageInfo-Name)
    <xsl:for-each select="//Behaviour/BehaviourInfo">
      <xsl:variable name="BhvrMsgName"
select="BehaviourMessages/BehaviourMessagesInfo/Name"/>
      <xsl:if test="$BhvrMsgName=$MsgName">
        <xsl:variable name="x"
select="BehaviourMessages/BehaviourMessagesInfo/OIDInfo/Message/MessageInfo/
MsgLevel[TextString!='Cleared']"/>
        <xsl:if test="$x">
          <xsl:text>This alarm message is triggered by the trap </xsl:text>
          <xsl:if test="$x[2]">s</xsl:if>
          <xsl:for-each select="Trap/Name">
           <B><xsl:value-of select="."/></B>
           <xsl:if test="position()&lt;last()"><xsl:text>,
</xsl:text></xsl:if>
          </xsl:for-each>
        </xsl:if>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>

  <xsl:template name="Call_MsgClearedBySystemFindClearTraps">
    <xsl:variable name="MsgName" select="Name"/>
    <xsl:for-each select="//Behaviour/BehaviourInfo">
      <xsl:variable name="BhvrMsgName"
select="BehaviourMessages/BehaviourMessagesInfo/Name"/>
      <xsl:if test="$BhvrMsgName=$MsgName">        
        <xsl:variable name="y"
select="BehaviourMessages/BehaviourMessagesInfo/OIDInfo/Message/MessageInfo/
MsgLevel[TextString='Cleared']"/>
        <xsl:if test="$y">
          <xsl:text> and will be cleared when the trap </xsl:text>
          <xsl:if test="$y[2]">s</xsl:if>
          <xsl:for-each select="Trap/Name">
           <B><xsl:value-of select="."/></B>
           <xsl:if test="position()&lt;last()"><xsl:text>,
</xsl:text></xsl:if>
          </xsl:for-each><xsl:text> comes in.</xsl:text>
        </xsl:if>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>

rgds,
L. Gnanendra Satish
- - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - 
This e-mail and any attachments may contain information which is
confidential, proprietary, privileged or otherwise protected by law. The
information is solely intended for the named addressee (or a person
responsible for delivering it to the addressee). If you are not the intended
recipient of this message, you are not authorized to read, print, retain,
copy or disseminate this message or any part of it. If you have received
this e-mail in error, please notify the sender immediately by return e-mail
and delete it from your computer.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.