Solved

How to set a parameter value dynamically?

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

828 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