Re: [xsl] double condition syntax

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:


To get the immediately preceding sibling of the element you're looking
at, you need:


To get its <MESSAGE> element child, you need:


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 !=

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.



Jeni Tennison

 XSL-List info and archive:

Current Thread