Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

734 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