[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL hold, compare, and replace param value
Hope this is what you're looking for:
When I run this XSL: <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:template match="country[not(parent::entry/following-sibling::entry)]"> <xsl:variable name="nextCountry" select="ancestor::group/following-sibling::group[1]/entry[1]/country"/> <xsl:choose> <xsl:when test="$nextCountry = . or not($nextCountry)"> <country><xsl:apply-templates/></country> </xsl:when> <xsl:otherwise> <country><xsl:value-of select="$nextCountry"/></country> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> Against your XML above, I get Fred's Country Changing as he is the only one who's next country differs,,, Am I reading you correctly? Spencer Tickner On 7/13/06, Michael Kay <mike@xxxxxxxxxxxx> wrote: > I have a problem holding on to a param or variable value in xslt. > Setting it Globally or Locally. > > How can I hold onto the country value? Compare to the next > value, if country is diff. then replace the value for that > param with the next country value?
|
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
|