RE: [xsl] Finding parent of the middle child

Subject: RE: [xsl] Finding parent of the middle child
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 20 Jun 2005 23:28:56 +0100
> Actually, it's version="1.0"
> 
> (//rec_gear_sec/*)[$gearMid] is returning the very first child, even
> though $gearMid returns 34. I wasn't even sure if that syntax would be
> allowed in 1.0.

Yes, it is allowed. But if $gearMid is a result tree fragment rather than a
number, then this expression doesn't do what you want. The RTF is converted
to a boolean and is always true. Use

<xsl:variable name="gearMid" select="...."/>

Michael Kay
http://www.saxonica.com/

Current Thread