BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
XQuery
XQuery Sorting Expressions
XQuery FLWR Expressions
XQuery Constructors
XQuery Logical Expressions
XQuery Comparison Expressions
XQuery Arithmetic Expressions
XQuery Sequence Expressions
Path Expressions
XQuery Primary Expressions
Programming with XQuery classes
XQuery Demo namespace
XQuery Demo
What is XQuery and ASP.NET?
What is XQuery?
Why do I need XQuery when I already have XSLT/XPath?
XQuery 1.0 syntax types and some query examples.
How to use XQuery in ASP.NET
Learn XQuery 1.0 fundamentals
<< XmlSerializer
XSLT >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :243

 

XQuery Conditional Expressions

XQuery has only support for the if – then – else conditional expression. It uses a Test Expression, which determines whether to go into the then, or the else expression block.

Worksheet 9: Conditional Expression examples

Expression:

Example(s):

Conditional Expressions

1. <root>

   {

     IF document("xqt")//title/text()="xxx"

     THEN <true/>

     ELSE <false/>

   }

   </root>

This expression will output the following:

<?xml version="1.0"?>

<root>

  <FALSE/>

</root>

Note that the value 'false' (which is a string) is returned as the Boolean value 'FALSE'.

2. <root>

   {

     IF document("xqt")//title/text()

       ="Introduction to XQuery"

     THEN <true/>

     ELSE <false/>

   }

   </root>

as you may have guessed already, this xquery will return:

<?xml version="1.0"?>

<root>

  <TRUE/>

</root>

As with the first example, the returned value is the Boolean 'TRUE' and not the string 'true'

 


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

An immediate job opportunity as a B
Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C

View all Jobs (Add yours)
View all CV (Add yours)



answering service
conference calling
swimming pool builder
spfxmasks
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP