Return to doc.sitecore.com

Valid for Sitecore 6.0.0, 5.3.2
  Operators
Prev

Below is a list of operators that can be used in Sitecore Query expressions:

Operator Description Example Return value
| Contracts two Item-sets //*/Products|//*/Shapes Returns children of Products and Shapes Items
+ Addition 6 + 4 10
- Subtraction 6 - 4 2
* Multiplication 6 * 4 24
div Division 8 div 4 2
= Equal position()=3 true if position() is 3,
false otherwise
!= Not equal position()!=3 False if position() is 3,
true otherwise
Less than position()<4 true if position() is less than 4
<= Less than or equal to position()<=4 true if position() is less than or equal to 4
Greater than position()>4 true if position() is greater than 4
>= Greater than or equal to position()>=4 true if position() is greater than or equal to 4
or or position()=3 or position()=4 true if position() is 3 or 4, false otherwise
and and position()>3 and position()<7 true if position() is between 3 and 7, false otherwise
mod Modulus (division remainder) 5 mod 2 1

 

Examples:

query:/sitecore/content/home/*[(2+3) div 2 - 1]

query:/sitecore/content/Home/*[3 * 2 - 6 div 2]

query:/sitecore/content/home/*[(@@name='Item1' or @@name='Item2') and position()>= 1 and position() < 5 and position() != 3]

query:/sitecore/content/Home/Products/Documents/Old Document/ancestor-or-self::*|self::


Prev