[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: value of variable inside a condition doesn't work?

Subject: RE: value of variable inside a condition doesn't work?
From: "Dunning, John" <JDunning@xxxxxxxxx>
Date: Tue, 28 Jan 2003 14:20:36 -0500
xslt value of variable
Your variables are only in scope within your 'if' statements; not knowing
what the rest of your code looks like, I offer this approach:
<xsl:variable name="stadt">
	<xsl:choose>
		<xsl:when test="($lang)='1' ">Stadt</xsl:when>
		<xsl:when test="($lang)='2'">city</xsl:when>
	</xsl:choose>
</xsl:variable>

<xsl:variable name="Texteingabe">
(etc.)
</...>

HTH,
John

-----Original Message-----
From: Hubert Holtz [mailto:Turnhose_alt@xxxxxxx]
Sent: Tuesday, January 28, 2003 2:05 PM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  value of variable inside a condition doesn't work?


Hy,

first of all I know there is this <i18n> thing to make multilanguage sites,
but that's not the topic.

I have enabled xslt-with-parameter in my sitemap, in my xsl file i have a
global parameter 'lang' this is the parameter which should
contain the value of the equal url-parameter, so far so good.

Now I want to output text fragments in 2 languages, depending on this
parameter, so I thought of sth. like this:

-- code --

<xsl:if test="($lang)='1' ">
    <xsl:variable name="stadt" select="Stadt"/>
     <xsl:variable name="Texteingabe" select="Hier Text eingeben"/>
    <xsl:variable name="berichtstatus" select="aktuell"/>
</xsl:if>

<xsl:if test="($lang)='2' ">
    <xsl:variable name="stadt" select="city"/>
    <xsl:variable name="Texteingabe" select="Please enter text"/>
    <xsl:variable name="berichtstatus" select="current"/>
</xsl:if>

..

<td><xsl:value-of select="$stadt"/></td>

-- code --


But I get an error message, that there is no 'stadt' variable, if I delete
the <xsl.if> part then there is no error message, but then I can't change
the
value of the variable depending on the 'lang' paramter, of course.

So could it be that variables can't be set in an if statement and if that's
true what would be the solution?


thanks
Homer30 


  


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.