Loading in 5 sec....

Is the cost of the 4 th juicer less than the cost of its following juicers?PowerPoint Presentation

Is the cost of the 4 th juicer less than the cost of its following juicers?

- By
**oral** - Follow User

- 118 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' Is the cost of the 4 th juicer less than the cost of its following juicers?' - oral

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

### Is the cost of the 4th juicer less than the cost of its following juicers?

Incorrect

//juicer[4]/number(cost ) < //juicer[4]/following-sibling::juicer/number(cost )

The XPath gives the right answer for this data:

82.00 < (234.00, 639.99)

(82.00 < 234.00) or (82.00 < 639.99)

T or T

T

But it gives the wrong answer for this data:

82.00 < (72.00, 639.99)

(82.00 < 72.00) or (82.00 < 639.99)

F or T

T

Correct

not(//juicer[4]/number(cost ) >= //juicer[4]/following-sibling::juicer/number(cost ))

The XPath gives the right answer for this data:

not(82.00 >= (234.00, 639.99))

not((82.00 >= 234.00) or (82.00 >= 639.99))

not(F or F)

T

And it gives the right answer for this data:

not(82.00 >= (72.00, 639.99))

not((82.00 >= 72.00) or (82.00 >= 639.99))

not(T or F)

F

Guideline for using general comparison operators

- If you want to do general comparison of sequences, don’t do this: A positive-operator B
- Instead, do this: not (A negative-operator B)
- Example, don’t do this: A < BInstead, do this: not(A >= B)
- Example, don’t do this: A = BInstead, do this: not(A != B)
- Example, don’t do this: A >= BInstead, do this: not(A < B)

Where A and/or B are sequences

Is 10 less than all the values in this sequence: (20, 30)?

The overwhelming temptation is to write this XPath:

10 < (20, 30)

The XPath works for this particular set of data, but change the data and it fails:

10 < (5, 30)Let’s see why: (10 < 5) or (10 < 30)

F or T

T

Instead, use this XPath:

not(10 >= (5, 30))

not((10 >= 5) or (10 >= 30))

not(F or T)

F

Is 10 equal to all the values in this sequence: (10, 10)?

The overwhelming temptation is to write this XPath:

10 = (10, 10)

The XPath works for this particular set of data, but change the data and it fails:

10 = (5, 10)Let’s see why: (10 = 5) or (10 = 10)

F or T

T

Instead, use this XPath:

not(10 != (5, 10))

not((10 != 5) or (10 != 10))

not(T or F)

F

Download Presentation

Connecting to Server..