[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problems with variables.
> 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. <xsl:otherwise> 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... </xsl:otherwise> 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="."/> </xsl:if> </xsl:template> 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. David XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|