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

Re: For loop over a collection, multiple

David Lee dlee at calldei.com
Wed Mar 3 14:04:40 PST 2010


  Re: For loop over a collection
> Just look at the original query that generated this thread, and try to
> write it with
> (a) scripting
> (b) XProc and
> (c) smlsh
>
> I really don't get this discussion/opposition to scripting extensions,
> and I really don't understand
>  this kind of arguments.
>

Just an example (and an agreement that I think scripting XQuery is a great
thing. but there is more then one way to skin the cat ).

Original Query fragment:

=======================
declare variable $docs :=
   collection(iri-to-uri(concat('file:///xmlsource',
'?recurse=yes;select=*.(xml);parser=org.apache.xml.resolver.tools.ResolvingXMLReader')));

for $topic in $docs
where ($topic//*[contains(@href, '\') or contains(@conref, '\')])
return
   base-uri($topic)

========================


c) xmlsh
Its not as verbose as other scripting languages integrating with xquery, and 
about as efficient as anything within xquery.

PASS=()
for file in $(find /xmlsource -name *.xml) ; do
    xread doc < $file
    <[ test1_xquery_expr ...  $doc ]> && PASS+=<[ base-uri($doc) ]>
    <[ test2_xquery_expr  $doc   ]> && PASS+=<[  base-uri($doc) ]>
...
done

echo Passed Tests $PASS

I wont try to write this in xproc.


----------------------------------------------------
David A. Lee
http://x-query.com/mailman/listinfo/talk
http://www.calldei.com
http://www.xmlsh.org
 



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-2011 All Rights Reserved.