[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Better way to structure XQuery

Stacy.Ladnier at noaa.gov Stacy.Ladnier at noaa.gov
Wed Jul 8 13:41:13 PDT 2009


  Better way to structure XQuery
I am trying to write a query used to detect what type of Profile a
particular file is. I do this by detecting the presence of tags that are
specific to that particular profile. The paths to check can be in
multiple locations, not necessarily sharing the same parent (often the
metadata element is the only thing in common with the paths) but, it is
possible as shown in the two paths in the code, that some are siblings.

Ideally, once the method detects a path exists, the code should change
the profileType from its default of Standard to the new type of
Biological. All other processing is considered insignificant and it
would be nice to break out of the loop as soon as the change occurs.
Unfortunately, I have had no luck getting that to work.

The following code is what I have now, and it works. But something tells
me it can be better. I am using XQuery implementation within the eXist
database if that helps.

let $mydoc :=doc('http://localhost:8080/exist/rest/db/bio.xml')
let $profileType := 'Standard'
let $paths := ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin,
$mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax, path3, path4, ...)

for $p in $paths
   let $profileType := if ($p) then 'Biological' else $profileType


I would LOVE to use something similar to Ken's example, where I can
store the paths in an xml file and pull them in, but I am not fond of
using the two step process his example requires. Not saying it is wrong,
just personal preference and ease of use within Orbeon/eXist framework.

Thanks for all the responses! This is my first post and I am impressed
at the level of assistance everyone is taking the time to give me.
-------------- next part --------------
Skipped content of type multipart/related-------------- next part --------------
_______________________________________________
http://x-query.com/mailman/listinfo/talk
http://x-query.com/mailman/listinfo/talk


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.