Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  XML (Extensible Markup Language)

Boolean, Comparison, and Set Expressions


Filter patterns can contain Boolean expressions, comparison expressions, and set expressions. Shortcuts listed in the following table represent alternative symbols that are also provided in this XSL implementation. This documentation discusses these expression operators.

OperatorShortcutDescription
$and$&&Logical-and
$or$ || Logical-or
$not$ Negation
$eq$ = Equality
$ieq$ Case-insensitive equality
$ne$ != Not equal
$ine$ Case-insensitive inequality
$lt$ < Less than
$ilt$ Case-insensitive less than
$le$ <= Less than or equal
$ile$ Case-insensitive less than or equal
$gt$ > Greater than
$igt$ Case-insensitive greater than
$ge$ >= Greater than or equal
$ige$ Case-insensitive greater than or equal
$all$ Set operation; returns TRUE if the condition is true for all items in the collection
$any$ Set operation; returns TRUE if the condition is true for any item in the collection

Precedence order (from highest to lowest) for comparison operators and Boolean operators is shown in the following table.

1.( )Grouping
2.= != $lt$ $le$ $gt$ $ge$ $eq$ $ne$ $ieq$Comparisons
3.$not$Boolean not
4.$and$Boolean and
5.$or$Boolean or

Boolean expressions can match all nodes of a particular value, or all nodes with nodes in particular ranges. Boolean expressions are in the form (left-side-value $op$ right-side-value), and return a Boolean result. Applications can provide additional operators as needed, although this practice is discouraged.

Operators are case sensitive.

Boolean AND and OR

The Boolean operators $and$ and $or$ perform logical-and and logical-or operations, respectively. The Boolean operators, in conjunction with grouping parentheses, can be used to build very sophisticated logical expressions. Note that spaces are not significant and can either be omitted or included to make the expressions easier for people to read.

Examples

Find all author elements that contain at least one degree and one award:

author[degree $and$ award]

Find all author elements that contain at least one degree or award and at least one publication:

author[(degree $or$ award) $and$ publication]

Boolean NOT

The Boolean $not$ operator negates the value of an expression within a filter pattern.

Examples

Find all author elements that contain at least one degree element and that contain no publication elements:

author[degree $and$ $not$ publication]

Find all author elements that contain publication elements but do not contain either degree elements or award elements:

author[$not$ (degree $or$ award) $and$ publication]

See Also

Sample Data, Examples


Does this content meet your programming needs? Write us!

Back to topBack to top

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site