[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Scope of variables
Subject: [xsl] Scope of variables From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxx> Date: Thu, 8 May 2003 12:00:23 -0700 |
Hello, I have 2 questions: 1) If I define a variable at the top of a template rule and then later try to update the value of this variable later down in the template, I always get the error "Can't define variable twice...". So how do you reassign a value to a variable. 2) About scope: Within a for-each loop I have a choose. In the choose I have a single test and an otherwise. The result of the choose is setting the value of a variable. Just below this choose logic I am referencing the value but am getting the error "A reference to variable or parameter 'currentVAL' cannot be resolved". Where did I lose scopE on this variable (currentVAL)? Here is a bit of the code from this template: BEGIN SNIPPET... <xsl:for-each select="$xmTmplt/FLDS/FLD"> <xsl:variable name="innerFLD" select="@name" /> <!-- DETERMINE IF TEMPLATE DOC HAS A DEFAULT VALUE SET --> <xsl:choose> <xsl:when test="'a'='a'"> <xsl:variable name="currentVAL">TESTING</xsl:variable> </xsl:when> <xsl:otherwise> <xsl:variable name="currentVAL" select="$outerCurrent/@*[name() = $innerFLD]"/> </xsl:otherwise> </xsl:choose> <xsl:if test="@viewable='true' or not(@viewable)"> <tr> <td><!-- lookup text for display in xml template --> <xsl:value-of select="@text"/></td> <td> <xsl:choose> <xsl:when test="$xmTmplt/FLDS/FLD[@name=$innerFLD]/@edit='true'"> <!-- make edit fields --> <xsl:call-template name="MAKE_INPUT_BOX"> <xsl:with-param name="input_name"><xsl:value-of select="$innerFLD"/></xsl:with-param> <xsl:with-param name="input_value"><xsl:value-of select="$currentVAL"/></xsl:with-param> .... END SNIPPET Thanks for the help, Karl XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSL Problem with IE, Jim Fuller | Thread | Re: [xsl] Scope of variables, Karl J. Stubsjoen |
Re: [xsl] Newline problems, Vishwajit Pantvaidya | Date | Re: [xsl] Scope of variables, Karl J. Stubsjoen |
Month |
Keywords