Subject: RE: [xsl] Setting values for variable From: "Michael Kay" <mhk@xxxxxxxxx> Date: Fri, 10 Sep 2004 17:43:29 +0100 |
> But just to ilustrate how vars should be used, > > <xsl:variable name="t1"> > <xsl:value-of > select="sum(/Trade/Record[Payment]/Payment)" /> > </xsl:variable> Don't use this construct unless you have a very good reason. It's much better to write: <xsl:variable name="t1" select="sum(/Trade/Record[Payment]/Payment)" /> Why? Firstly, it's shorter and more readable. More importantly, the resulting value is a number, not a result tree fragment. A number is a much simpler object than a result tree fragment, so it's cheaper to create and cheaper to access. There are also some contexts, for example in the predicate P[$t1], where it's important for correct operation that the value should be a number. Michael Kay
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Setting values for variab, David Carlisle | Thread | Re: [xsl] Setting values for variab, john lee |
RE: RE: RE: [xsl] Setting values fo, john lee | Date | RE: [xsl] Setting values for variab, xptm |
Month |