?
Solved

How to reset a variable value and use if-block in xsl syntax

Posted on 2011-02-18
3
Medium Priority
?
582 Views
Last Modified: 2013-11-08
I have  a variable that is set to value of an attribute within a node. now i need to do a check within an if-else block and reset the value of this variable. how do i do this in xsl syntax?

this is the varName
<xsl:variable name="SubZone" select="$varSubZone/@code"/>

i now need to test if this variable contains ("BL", 'AC", 'GR") and if so then set SubZone= "112"
otherwise leave as is.

all of this is inside a <when> bracket
please advise.


0
Comment
Question by:badtz7229
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 34931779
First, variable don't vary in XSLT
They keep the assigned value all through their lifetime (they are more like constants)

You have however full access to the entire XML tree.
So it is easy to create selection nodesets and test against.

Can you please explain what you really want, so we can help you with that

(so post some input, xslt and expected output)
0
 

Author Comment

by:badtz7229
ID: 34938215
hi Gertone:
i actually resolved this by using a choose when statement and defining my new node as a string inside the statement instead of a variable to define it for the same reason u stated
thanks.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 34938294
welcome
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question