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

Re: Variable access

Subject: Re: Variable access
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 20 Sep 2002 11:37:13 +0100
oidinfo firstname
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

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.