RE: [xsl] conditional declaretion of a variable

Subject: RE: [xsl] conditional declaretion of a variable
From: Sundar Shanmugasundaram <SSHANMUGASUNDARAM@xxxxxxxxxxxxx>
Date: Fri, 18 Apr 2003 18:30:22 +0530
Hi,

Variable has to be declared like this:

<xsl:variable name="valueField">
<xsl:choose>
  <xsl:when test="@valueField">
	<xsl:value-of select="@valueField"/>  </xsl:when>
  <xsl:otherwise>
	<xsl:value-of select="@field"/>
  </xsl:otherwise>
</xsl:choose>
</xsl:variable>

Does this answer your question?

sundar


>>hi!

>>im wondering why something like this doesnt work:

>><xsl:variable name="field" select="@field" />

>><xsl:choose>
>><xsl:when test="@valueField">
>>    <xsl:variable name="valueField" select="@valueField" />
>>  </xsl:when>
>>  <xsl:otherwise>
>>    <xsl:variable name="valueField" select="@field" />
>>  </xsl:otherwise>
>></xsl:choose>

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

i would use the valueField variable for a value attribute
of a option element (html)..

thanks!

ciao!
florian




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


Current Thread