|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Variable access
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








