[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: is the variable really out of scope??
> I read through the faq and tried to find an answer to the scope issue. > I found that the faq mentions that a variable within a choose tatement > has a scope confined to that xsl element. However, it does not mention > the scope of the variables external to the xsl element. For all I know, a variable's scope is limited to the element of which the variable element is a direct child, and all descendents of that element. A variable binding can never cross to a sibling or be passed to an ancestor. That's just the way it is. But I can't quite see what your problem is, because in your code below, you properly wrap the choose statement inside the variable statement, so that you will have the variable in scope after that. I may be missing something, but what you list there should work in principle. Is there a better way for me to tackle this problem other than creating three separate templates for my choose statement? I can only see two choose statements, one for w and one for h. Although, you don't handle your cases according to your pseudo code :-) If you want only one choose statement you may find this more pleasant: <xsl:variable name="wh"> <xsl:choose> <xsl:when test="..."> <pair w="..." h="..."/> </xsl:when> <xsl:when test="..."> <pair w="..." h="..."/> </xsl:when> <xsl:when test="..."> <pair w="..." h="..."/> </xsl:when> <xsl:otherwise> <pair w="..." h="..."/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="w" select="$wh/pair/@w"/> <xsl:variable name="h" select="$wh/pair/@h"/> Please look specifically at the 'w' and 'h' variables and their updates based on 'k' and 'i'. To help clarify my problem, I have provided my xsl script: -- Gunther Schadow, M.D., Ph.D. gschadow@xxxxxxxxxxxxxxx Medical Information Scientist Regenstrief Institute for Health Care Adjunct Assistant Professor Indiana University School of Medicine tel:1(317)630-7960 http://aurora.regenstrief.org XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|