Subject: Re: [xsl] double condition syntax From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Sat, 7 Feb 2004 16:42:13 +0000 |
Hi Marina, > I need to add a second condition to variable 'vNumNotSame' that also > checks to see if the MESSAGE was the same as the previous sibling > MESSAGE, and if so NOT to count it. The current node-set is constructed with: LOG/*[number(TARGET_CHAR_LOCATION_ID) != number(LOCATION_ID)] To get the immediately preceding sibling of the element you're looking at, you need: preceding-sibling::*[1] To get its <MESSAGE> element child, you need: preceding-sibling::*[1]/MESSAGE And to make sure that it's not the same as the context element's <MESSAGE> element, you need: preceding-sibling::*[1]/MESSAGE != MESSAGE You need to test this condition *and* the one that you've got at the moment, so the final path is: LOG/*[number(TARGET_CHAR_LOCATION_ID) != number(LOCATION_ID) and preceding-sibling::*[1]/MESSAGE != MESSAGE] So to set $vNumNotSame, you need: <xsl:variable name="vNumNotSame" select="count(LOG/*[number(TARGET_CHAR_LOCATION_ID) != number(LOCATION_ID) and preceding-sibling::*[1]/MESSAGE != MESSAGE])"/> Note that you probably want to change how to calculate the number of messages sent to the *same* location, since it now isn't the same as $vTotalSent - $vNumNotSame. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
<- Previous | Index | Next -> |
---|---|---|
[xsl] double condition syntax, marina | Thread | Re: [xsl] double condition syntax, marina |
[xsl] double condition syntax, marina | Date | Re: [xsl] double condition syntax, marina |
Month |