Solved

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

Posted on 2011-02-18
3
575 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 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

776 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