Re: Problems with variables.

Subject: Re: Problems with variables.
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 30 Jul 1999 09:26:28 +0100 (BST)
> I'm trying to suppress a field if the same value appears in the next item. 
> For example, if the data looks like this

you may find it helpful to look back through the archives of this list,
this question seems to have come up several times this week.

this sets the value of the variable varUser for the current scope
				<xsl:variable name='varUser' expr="."/>
				User <xsl:value-of select="."/>
which ends here...

If you want to know if the value is the same as the previous one,
just ask that, no need to try (and fail) to mess around with side
effects like setting global variables.

	<xsl:template match="USER_ID">
         <xsl:if test="not(.=preceding-sibling::USER_ID[1])">
            User <xsl:value-of select="."/>

This assumes that your input is sorted, if you need to sort the
input to bring all records with the same user together, see answers to
earlier questions this week.


 XSL-List info and archive:

Current Thread