xsl-list
[Top] [All Lists]

RE: conditional declaretion of a variable

2003-04-18 06:00:22
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



<Prev in Thread] Current Thread [Next in Thread>