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

Query Through Multiple Files

Michael Kay mike at saxonica.com
Mon Jan 21 21:04:08 PST 2008


  Query Through Multiple Files

> I tried using 
> distinct-values(doc("1.xml"), doc("3.xml"), doc("4.xml"),  
> doc("2.xml"))//title, but I got the error that there should 
> be only 2 arguments. 

You didn't read my example carefully enough

distinct-values(( doc("1.xml"),
  doc("2.xml"),
  doc("3.xml"),
  doc("4.xml"))//ad)

Firstly, you want to find the set of titles and then take the distinct
values in this set: so the "//title" part needs to inside the argument to
distinct-values(). The way you've written it, you're taking four documents,
then eliminating duplicates, then taking the title elements within those
that are left.

Secondly, if you supply a sequence to a function that expects a single
argument then you need to double the parentheses, for example
sum((1,2,3,4,5)) or distinct-values((1,2,2,4,4)). That's to make it clear
you are passing one argument which is a sequence of five integers, not five
arguments that are single integers. IN your case you've called
distinct-values() with four arguments, rather than with a single argument
that is a sequence.

Michael Kay
http://www.saxonica.com/




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.