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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1172)
+ Stylus Studio Technical Forum (14512)
+ Website Feedback (247)
+ XSLT Help and Discussion (7597)
- XQuery Help and Discussion (1944)
-> + What path notation works when ... (6)
-> - Xquery Exception (1)
-> + [java] [Fatal Error] Test.xml:... (2)
-> + unable to produce correct XML ... (2)
-> + where can I find stylusxql uti... (3)
-> + Trouble Mapping Multiple Eleme... (3)
-> - input parameter (1)
-> - set element value (1)
-> + Xquery Performance Issue (21)
-> + Run Xquery Program using Java (4)
-> + XQuery XML to CSV (3)
-> + XQuery MySQL connector (4)
-> + XQuery with JDBC connection is... (3)
-> + Create FTP Server (2)
-> + XQuery Nested Loop Lookup (5)
-> + Xpath using a Variable for [@I... (2)
-> - My xqDoc option is disabled. (1)
-> + Xpath ancestor selection (4)
-> + Exception: sequence of more th... (2)
-> + XQUF usage (3)
-- [1-20] [21-40] [41-60] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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 oper="and">
<assert acrtreftype="prodattr" acrtidref="pa02" value="006"/>
<assert acrtreftype="condition" acrtidref="c02" value="PRE"/>

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

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

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

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 :)

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

Hope this helps,

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.

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!  

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.