Subject: Re: [xsl] Variable access From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 20 Sep 2002 11:37:13 +0100 |
Hi Gnanendra, > I would like to declare a variable and store the "Cleared" action in > the <for-each> iteration, and then I have to access it again after > the loop ends (It would be even more nice if I could break the loop > on encountering the 'Cleared' text) to do some processing based on > the status of the action. Can anyone help me with this? Sure. If you change the way that you think about the problem, it becomes a lot more obvious what the XSLT solution is. Instead of saying *how* you want to get the result that you want, specify *what* the result that you want is. In your case, think of it as: "I want to work out whether any of the OIDMapping elements have an ActionString element child whose value is 'Cleared'. If they do, then I want to say 'YES'; if they don't I want to say 'NO'" You can test whether there are any OIDMapping elements whose ActionString element child is 'Cleared' by trying to select them: MsgLevel/OIDInfo/OIDMapping[ActionString = 'Cleared'] So a solution is simply: <xsl:template name="Call_ClearedBySystemMapped"> <xsl:choose> <xsl:when test="MsgLevel/OIDInfo/OIDMapping [ActionString = 'Cleared']"> <xsl:text>YES</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>NO</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Variable access, Satish, L. Gnanendra | Thread | RE: [xsl] Variable access, James Fuller |
[xsl] RE: replace < and > wit, Dimitre Novatchev | Date | RE: [xsl] Variable access, James Fuller |
Month |