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

Re: not(not() and not())

Subject: Re: not(not() and not())
From: Roger Glover <glover_roger@xxxxxxxxx>
Date: Sat, 16 Nov 2002 22:37:20 -0800 (PST)
xsl if negate
Gustaf Liljegren <gustafl@xxxxxxxxxx> wrote:
> I seem to have a problem with logic.

I agree.  This is a logic problem, not some esoteric behavior of XSLT.


> <!-- Paint border unless it's the last row in the last rowgroup. -->
> <xsl:if test="not(not(parent::tr/following-sibling::tr) and
>               not(ancestor::tbody/following-sibling::tbody))">
>   <xsl:call-template name="draw-border-bottom"/>
> </xsl:if>
> 
> is not exactly the same as this:
> 
> <!-- Paint border unless it's the last row in the last rowgroup. -->
> <xsl:if test="parent::tr/following-sibling::tr and
>               ancestor::tbody/following-sibling::tbody">
>   <xsl:call-template name="draw-border-bottom"/>
> </xsl:if>
> 
> The first gives the correct result, but the second paints borders only on
> all but the last rowgroup. Shouldn't "... and ..." always be the same as
> "not(not(...) and not(...))"? If not, is it a better way to write the above?

The logic principle that applies here is commonly referred to as "DeMorgan's
Law".  Using your notation, DeMorgan's Law states that "... and ..." is always
the same as "not(not(...) or not(...)).  That is not the usual formulation
though; the usual forulation reads like this:  for any boolean-valued
expressions A and B, "not(A and B)  =  not(A) or not(B)".  Applying a not()
operation to both sides of the equation leads to the formulation that directly
answers your question

So, in other words, if you want to negate an logical expression of "ANDed"
terms, you can do it by negating the individual terms *AND* changing the "ANDs"
to "ORs".


=====
-- Roger Glover

   "Have you ever noticed, it's 'a penny for your thoughts',
    but you put in your 'two cents worth'?....
    Somebody somewhere is making a penny."
            - Steven Wright

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.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.