0

In my case,

I have to use a variable outside loop with some default values and in loop I have to set it to some values.

How do I achieve this? Please let me know the solution.

Sample code(that I have used):

 <xsl:variable name="flagforselectedOption" select="'true'"/>
    <xsl:for-each>
      <xsl:if test="">
        <xsl:variable name="flagforselectedOption" select="'true'"/>
      </xsl:if>
    </xsl:for-each>
 </xsl:variable>

It doesn't work for me. Please let me know how to do this.

2 Answers 2

2

With XSLT variables are immutable, i.e. you cannot change their value once set. This means that you have to re-think the logic of your transform.

Sign up to request clarification or add additional context in comments.

Comments

0

Describe your problem: the input XML, the output XML, and how they relate to each other. Then we can explain how to do it in a functional, declarative language like XSLT. Reverse engineering your requirement from code that doesn't work isn't possible.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.