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

Re: double condition syntax

Subject: Re: double condition syntax
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Sat, 7 Feb 2004 16:42:13 +0000
xsl when or condition
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.