?
Solved

How to set a parameter value dynamically?

Posted on 2003-10-22
4
Medium Priority
?
229 Views
Last Modified: 2010-04-17
How to set a parameter value dynamically?


I have a parameter called language

<xsl:param name="language">EN</xsl:param>

the value of parameter i will pass the value  from outside.

in my xml file i am trying to get is:

if the outside parameter value is EN,
then i want to set the parameter value to EN

if the outside parameter value is ''(empty)
i want to set the parameter value to EN

if the outside parameter value is FR
i want to set the parameter value to FR?

Thanks for your reply

vihar123
0
Comment
Question by:vihar123
3 Comments
 
LVL 17

Expert Comment

by:rstaveley
ID: 9600981
Depends what you are using.

msxsl.exe takes command line parameters param=value.

If you are using Java, you use something like this....

        Source xsltSrc = new StreamSource(file);
        Transformer transformer = transformerFactory.newTransformer(xsltSrc);
        transformer.setParameter("param","value");
0
 

Author Comment

by:vihar123
ID: 9604928
Hi,
I am using XSL.

I got the answer.
Here is my solution:

                <xsl:param name="lang">EN</xsl:param>

            <xsl:variable name="language">
            
                  <xsl:choose>
                        <xsl:when test="$lang = 'EN'">
                              <xsl:text>EN</xsl:text>
                        </xsl:when>
                                                                <xsl:when test="$lang = ' ' ">
                              <xsl:text>EN</xsl:text>
                        </xsl:when>
                                                                <xsl:when test="$lang = 'FR'">
                              <xsl:text>FR</xsl:text>
                        </xsl:when>
                        <xsl:otherwise>
                              <xsl:value-of select="$lang"/>
                        </xsl:otherwise>
                  </xsl:choose>
            </xsl:variable>


vihar123
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9622599
PAQed, with points refunded (100)

Computer101
E-E Admin
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Make the most of your online learning experience.
Six Sigma Control Plans
Progress

840 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