|
[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, multipleDavid Lee dlee at calldei.comWed Mar 3 14:04:40 PST 2010
> 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






