xsl-list
[Top] [All Lists]

RE: not(not() and not())

2002-11-18 02:00:48
Gustaf,

DeMorgan's Law states:

  A & B => ¬(¬A | ¬B)

and

  A | B => ¬(¬A & ¬B)

(Where ¬ is the boolean 'not' operator).

That is, if you take two expressions A and B (such as
parent::tr/following-sibling::tr and
ancestor::tbody/following-sibling::tbody from your example),
then 

parent::tr/following-sibling::tr and
ancestor::tbody/following-sibling::tbody

is the same as

not(not(parent::tr/following-sibling::tr) or
not(ancestor::tbody/following-sibling::tbody))

NOTE: the 'and' has changed to an 'or'.

Regards,

Dan.

-- 
Danny Yates
Technical Architect
Abbey National Treasury Services
E-mail: Danny(_dot_)Yates(_at_)ants(_dot_)co(_dot_)uk
Phone: +44 20 7756 5012
Fax: +44 20 7612 4342


-----Original Message-----
From: Gustaf Liljegren [mailto:gustafl(_at_)algonet(_dot_)se]
Sent: 17 November 2002 04:15
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] not(not() and not())


I seem to have a problem with logic. Can someone explain why this XPath
expression:

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

Gustaf


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


***************************************************************************
This communication (including any attachments) contains confidential 
information.  If you are not the intended recipient and you have received this 
communication in error, you should destroy it without copying, disclosing or 
otherwise using its contents.  Please notify the sender immediately of the 
error.

Internet communications are not necessarily secure and may be intercepted or 
changed after they are sent.  Abbey National Treasury Services plc does not 
accept liability for any loss you may suffer as a result of interception or any 
liability for such changes.  If you wish to confirm the origin or content of 
this communication, please contact the sender by using an alternative means of 
communication.

This communication does not create or modify any contract and, unless otherwise 
stated, is not intended to be contractually binding.

Abbey National Treasury Services plc. Registered Office:  Abbey National House, 
2 Triton Square, Regents Place, London NW1 3AN.  Registered in England under 
Company Registration Number: 2338548.  Regulated by the Financial Services 
Authority (FSA).
***************************************************************************


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>