[xsl] Last () -1

Subject: [xsl] Last () -1
From: "John Reid" <John.Reid@xxxxxxxxxxxxxxx>
Date: Sat, 4 Oct 2003 09:02:42 +1000
G'day,

I am not quite getting the results I expected and I suspect it is
because I am misreading how position and last works. I want to have a
variable that selects nodes, sorts the nodes and selects the last. If I
assume that the nodes are "numbered"  starting from the last as 
16, 15, 14, 13 ,12 

and I say 'day[position() &gt; last()-5 and position() &lt; last()-1]'
then am I selecting 14, 13 12.?? Maybe there is a better way

Any thoughts

Salud

John



<xsl:variable name="varL52">

<xsl:for-each select="day[position() &gt; last()-3 and position() &lt;
last()-1]">
<xsl:sort select="cl"  order="descending" data-type="number"/>
<xsl:if test="position()=last()"><xsl:value-of select="cl" /></xsl:if>
</xsl:for-each>

</xsl:variable>

	<asx id="AAI" coy="ALCOA INC." sector="Materials" asxNo="None"
currHi="6600" currCl="6600" currVol="0" currDate="20031002">
		<day id="20030804" weekno="1">
			<op>6600</op>
			<hi>6600</hi>
			<lo>6600</lo>
			<cl>6600</cl>
			<vol>0</vol>
		</day>
		<day id="20030805" weekno="1">
			<op>6600</op>
			<hi>6600</hi>
			<lo>6600</lo>
			<cl>6600</cl>
			<vol>0</vol>
		</day>
		<day id="20030806" weekno="1">
			<op>6600</op>
			<hi>6600</hi>
			<lo>6600</lo>
			<cl>6600</cl>
			<vol>0</vol>
		</day>
		<day id="20030807" weekno="1">
			<op>6600</op>
			<hi>6600</hi>
			<lo>6600</lo>
			<cl>6600</cl>
			<vol>0</vol>
		</day>
	</asx>


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


Current Thread