Solved

How to set a parameter value dynamically?

Posted on 2003-10-22
4
218 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
[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
4 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Make the most of your online learning experience.
Simple Linear Regression
Introduction to Processes

617 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