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]

counting matches between list items


I'm new to XSL, so this might be a simple question. I'm trying to compare
the items in two lists using XSL to check if an item at a certain position
in the two lists matches. For example, the lists below have 1 matching item.

<LISTS> 
	<LIST_A> 
		<ITEMS> 
			<ITEM type="dog" /> 
			<ITEM type="cat" /> 
			<ITEM type="fish" /> 
		</ITEMS> 
	</LIST_A> 
	<LIST_B> 
		<ITEMS> 
			<ITEM type="dog" /> 
			<ITEM type="fish" /> 
			<ITEM type="cat" /> 
		</ITEMS> 
	</LIST_B> 
</LISTS> 
I've tried using count() <xsl:variable name="listMatches"
select="count(LISTS/LIST_A/ITEMS[normalize-space(./attribute::type)=LISTS/LI
ST_B/ITEMS/attribute::type])"/> But count() does not take the position of
the elements into account. I can't figure out how to accumulate a count
using <xsl:for-each>. If anyone has any suggestions, please let me know. 
Thanks, 
- Matthew 


 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]