RE: [xsl] xsl:variable problems: Error in XPATH Expression

Subject: RE: [xsl] xsl:variable problems: Error in XPATH Expression
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Fri, 11 Jul 2003 16:16:54 -0400
[Greg Johnson]
> 
> What are the restrictions on using xsl:variables?
> Am I not allowed to use it in an xsl:sort element?
> I get the following error for the folowing xsl fragment:
> 
> <xsl:variable name="sortby">ARRIVED</xsl:variable>
> <xsl:variable name="ordering">descending</xsl:variable>
> 

Those sortby variable  contains a result tree fragments, and those
cannot be used instead of a node set - that is what  the error messages
tells you.  It has nothing to do with the use of a variable, but only
with the contents of the variable.

You can get the variables to contain the right things by a simple change
-

<xsl:variable name="sortby" select='ARRIVED'/>

Might as well do this also -
<xsl:variable name="ordering" select='"descending"'/>

Notice how the string has to be quoted, otherwise it would indicate
nodes named "descending".  The quotes signal that the thing is a string
instead of a set of nodes.

Cheers,

Tom P


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


Current Thread