This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Selecting a node set


Tony Click wrote:

> My problem is I need to identify a current node based on the subsequent
> node.  The following code gives me a true for each node that I want to keep
> and a false for the ones I don't want.  Unfortunatly, I need it in the form
> of a select.
> 
> 	<xsl:for-each select="endTime">
> 		<xsl:value-of select="count(
> following-sibling::endTime[1]/interval[@channelDetailId =
> current()/interval/@channelDetailId] ) != count( current()/interval ) "> 
> 	</xsl:for-each>
> 
> As soon as I try something like:
> 
> 	<xsl:value-of select="endTime[ count(
> following-sibling::endTime[1]/interval[@channelDetailId =
> current()/interval/@channelDetailId] ) != count( current()/interval ) ]"/>
> 
> That of course doesn't work ( I believe that is beacuse current() doesn't
> actually behave the same as it does in the for loop).  
> 

The information you're giving us is insufficient. In general I think the answer
should be that you cannot have a single XPath expression for the above without also
including in it some variable references.

In any specific case the answer may be different.

For example, if it is the case that a "channelDetailId" attribute value uniquely
identifies an "interval" element, then the following XPath expression will yield the
desired result:

endTime[interval/@channelDetailId 
     !=  
       following-sibling::endTime[1]/interval/@channelDetailId
       ]


This will be even simpler if we knew that an "endTime" has only one "interval"

Cheers,
Dimitre Novatchev.


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]