[xsl] xslt node-set variable transversal

Subject: [xsl] xslt node-set variable transversal
From: "Kyle Partridge" <kpartridge@xxxxxxxxxxxx>
Date: Tue, 30 Mar 2004 14:27:28 -0500
Hi,

This is probably an obvious question, but I still haven't been able to
get this to work.

I've got an xpath that narrows a set of all the regions in the document,
to the set of regions in a single "column":

<xsl:variable name="col-regions" select="//ws:region[parent::ws:regions
and @left&gt;0 and (@left+@width)&lt;$useable-page-width]"/>	

Then, I'm trying to iterate over that set:

<xsl:for-each select="$col-regions">
	<xsl:variable name="current-position" select="position()"/>	
	<xsl:apply-templates select="." mode="horizontal-region-block">
		<xsl:with-param name="following-regions"
select="$col-regions[position()&gt;=$current-position]"/>
		<xsl:with-param name="prev-region"
select="$col-regions[position()=$current-position-1]"/>
		<xsl:with-param name="top-adjust" select="$top-adjust"/>
	</xsl:apply-templates>
</xsl:for-each>

but this doesn't work - the XMLSpy debugger says I am not getting
anything in these params.

I have tried this with using $col-regions[etc....] (like above) to try
to get the following and preceding region or regions, and I have also
tried it using preceding-sibling with an enormous xpath expression
which, yet again, filters out regions that would not be in the current
column.  

Using preceding-sibling with an enormous xpath expression seems to work
- but I would rather not do an additional filtering every time I need to
find the prev or next region in the $col-regions list.  How come I can't
just reach back or forward one?

I am sure this is obvious but I just don't get it...I keep going back to
the books, but I still don't understand.

Thanks,
KP

Current Thread