Re: selecting similar nodes

Subject: Re: selecting similar nodes
From: "Pete Johnston" <P.Johnston@xxxxxxxxxxxxxxxxxx>
Date: Wed, 1 Sep 1999 17:06:13 GMT
[Richard Sargeant]

> If my current node is 1001,  I want to be able to process 1002, and 1003 at
> the same time. So I thought the following would work...
> 
> 	<xsl:for-each select="from-following(DESCR[text()=text()])">
> 		<xsl:call-template name="Details"/>
> 	</xsl:for-each>
> 
> What am I doing wrong ?

I'm not clear exactly where your loop is located (i.e. in the 
template matching which element), but I think it might help to make 
use of the current() function somewhere.... something like (this in a 
template matching ITEM):

<xsl:for-each
select="following::*[DESCR[text()=current()/DESCR/text()]]">

[Do whatever you want to do]

</xsl:for-each>

Current() was only added in the last draft and your syntax 
suggests you're using an earlier one, so if you don't upgrade you may 
need to save the current DESC/text() in a variable and then compare 
against the value of the variable. 

Also, as I set it up, this will process items 1002 and 1003 with 
1001, but also item 1003 with 1002 when the latter is reached... that 
may be what you want or it may not!

Pete Johnston
University of Glasgow


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


Current Thread