Re: [xsl] declaring global variable in XSL!

Subject: Re: [xsl] declaring global variable in XSL!
From: "Michael Beddow" <mbnospam@xxxxxxxxxxx>
Date: Tue, 21 Aug 2001 07:51:48 +0100
On Tuesday, August 21, 2001 5:58 AM
Tim Watts wrote:

> Also, I think I remember somone saying recently that you cannot
declare a
> *global* variable based on a condition.

Sorry, that was me in mode="wrong-end-of stick", drawing an incorrect
conclusion from the correct premiss that the XSLT content model doesn't
allow <xsl:if> or <xsl:choose> at the top level of the sheet, where
global assignments need to be made.

In a follow-up, Oleg drew my attention to the extremely rich content
model of <xsl:variable> and pointed out that the way to achieve
conditional initialisation of a global was to generate an RTF by using
<xsl:choose> within the content of a <xsl:variable> at top level. As a
result I think I now understand why and how the two possible methods of
initialising a variable are significantly different.

Other responses off-list confirmed that the technique I had figured out
myself was OK for my particular case, namely using the union operator on
two node sets, where one set will always be empty if the condition that
interested me is true. But that's much less general than the RTF
approach.

Michael
---------------------------------------------------------
Michael Beddow   http://www.mbeddow.net/
XML and the Humanities page:  http://xml.lexilog.org.uk/
---------------------------------------------------------


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


Current Thread