Subject: RE: [xsl] String comparisons From: "Satish, L. Gnanendra" <LGnanendra.Satish@xxxxxxxxxx> Date: Mon, 23 Sep 2002 09:20:32 +0200 |
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()<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()<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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] String comparisons, Jarno . Elovirta | Thread | [xsl] Insert PDF file, Eric . Reiter |
RE: [xsl] String comparisons, Jarno . Elovirta | Date | Re: [xsl] Partial Implementation of, Jeni Tennison |
Month |