Re: Calculations in XSL

Subject: Re: Calculations in XSL
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 25 Oct 1999 15:44:51 +0100 (BST)
   I need to add two values togethor, both are attributes.  I have seen several
   examples, all which look like they should work fine, but all of them have
   given me this error:

   Keyword xsl:variable may not be used here.
                                        ^^^^
                                        ^^^^
                                        ^^^^
                                        ^^^^
                                        ^^^^

   Are there circumstances where xsl:variable cannot be used?  I'm using it
   like this:

   <xsl:variable name="sum" select="$a + $b"/>

   If anyone knows of an example that works please could they send me the
   script.



It would be easier to offer help if you gave a clue _where_ you are
trying to use xsl:variable. Since the error message says that the error
is in the place where you have the xsl:variable element rather than the
particular attributes in this instance of the element.

As a wild guess you may be falling foul of this rule from section 11.5
of the PR:


     A binding shadows another binding if the binding occurs at a point
     where the other binding is visible, and the bindings have the same
     name. It is an error if a binding established by an xsl:variable or
     xsl:param element within a template shadows another binding
     established by an xsl:variable or xsl:param element also within the
     template. 

which says that you can not do two bindings of the same variable name
within the same template.

David


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


Current Thread