XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Santhosh ThottingalSubject: Selecting operator from XML to xquery
Author: Santhosh Thottingal
Date: 07 Nov 2006 11:22 AM
hi all,
I have an XML in the following form.
<evaluate oper="or">
<assert acrtreftype="prodattr" acrtidref="pa02" from="010" to="023"/>
<evaluate oper="and">
<assert acrtreftype="prodattr" acrtidref="pa02" from="001" to="005"/>
<assert acrtreftype="condition" acrtidref="c01" value="POST"/>
</evaluate>
<evaluate oper="and">
<assert acrtreftype="prodattr" acrtidref="pa02" value="006"/>
<assert acrtreftype="condition" acrtidref="c02" value="PRE"/>
</evaluate>
<assert>AIRPLANES WITH BENDIX BRAKES</assert>
</evaluate>

What I want to do is do this evaluation using xquery. Based on the oper attribute of evaluate , in xquery I need to do an and or or operations. Can some one suggest how to do this?
Thanks in advance
-santhosh

Postnext
Tony LavinioSubject: Selecting operator from XML to xquery
Author: Tony Lavinio
Date: 07 Nov 2006 11:05 PM
Our records don't show you as a Stylus Studio user, based on the
email address you used to register to this forum.
Which version are you using?
We offer free support to users of our product, but not users of all
products.

Postnext
Santhosh ThottingalSubject: Selecting operator from XML to xquery
Author: Santhosh Thottingal
Date: 07 Nov 2006 11:07 PM
Stylus Studio 2006 Release 3 XML Enterprise Edition, but not a registerd user

Postnext
Alberto MassariSubject: Selecting operator from XML to xquery
Author: Alberto Massari
Date: 08 Nov 2006 09:27 AM
Hi Santhosh,
it's not too clear to me what should be done with the content of the various "assert" elements, but this could be a starting point

declare function local:process_assert($node as element()) as xs:boolean
{
(: replace it with some processing of the "assert" node :)
true()
};

declare function local:process_evaluate($node as element()) as xs:boolean
{
let $operands := for $child in $node/*
return
if(node-name($child) = xs:QName("assert")) then xs:int(local:process_assert($child))
else
if(node-name($child) = xs:QName("evaluate")) then xs:int(local:process_evaluate($child))
else (),
$sum := sum($operands)
return
if($node/@oper = "or") then $sum > 0
else
if($node/@oper = "and") then $sum = count($operands)
else false()
};

Hope this helps,
Alberto

Posttop
Santhosh ThottingalSubject: Selecting operator from XML to xquery
Author: Santhosh Thottingal
Date: 09 Nov 2006 07:11 AM
Thanks a lot.
The assert statements will return boolean values, based on that evaluations will be done, the final output should be a boolean value. OR or AND operations will be applied to assert results.
I am new to XQuery and trying to learn for one of my project. And I am struggling to do the above descibed functionality.

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.