Solved

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

Posted on 2011-02-18
3
577 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Test ddwrt:UserLookup 1 71
tutorial for ebay api 3 77
PHP delete contents of file- before writing to it 6 49
C# XML Get Values 4 33
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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:

761 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