[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problems with variables.

Subject: Re: Problems with variables.
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 30 Jul 1999 09:26:28 +0100 (BST)
problems with variables in xsl
> 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:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.