<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = 
"urn:schemas-microsoft-com:vml" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word" xmlns:m = 
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR>
<STYLE>@font-face {
        font-family: Calibri;
}
@font-face {
        font-family: Consolas;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
P.MsoPlainText {
        FONT-SIZE: 10.5pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Consolas; mso-style-priority: 99; mso-style-link: "Plain Text Char"
}
LI.MsoPlainText {
        FONT-SIZE: 10.5pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Consolas; mso-style-priority: 99; mso-style-link: "Plain Text Char"
}
DIV.MsoPlainText {
        FONT-SIZE: 10.5pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Consolas; mso-style-priority: 99; mso-style-link: "Plain Text Char"
}
SPAN.PlainTextChar {
        FONT-FAMILY: Consolas; mso-style-priority: 99; mso-style-link: "Plain Text"; mso-style-name: "Plain Text Char"
}
.MsoChpDefault {
        mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=750060615-22012008><FONT face=Arial 
color=#0000ff size=2>I wasn't trying to give you a complete solution to your 
problem because I don't know what the problem is. I was only trying to explain 
why you got the error message that you got.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=750060615-22012008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=750060615-22012008><FONT face=Arial 
color=#0000ff size=2>If you want help writing your query, please explain what 
the source documents look like and what output you need.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=750060615-22012008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=750060615-22012008><FONT face=Arial 
color=#0000ff size=2>Michael Kay</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=750060615-22012008><FONT face=Arial 
color=#0000ff size=2>http://www.saxonica.com/</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> Wei, Alice J. [mailto:ajwei@indiana.edu] 
  <BR><B>Sent:</B> 22 January 2008 14:46<BR><B>To:</B> Michael Kay; 'Liam 
  Quin'<BR><B>Cc:</B> talk@x-query.com<BR><B>Subject:</B> RE: [xquery-talk] 
  Query Through Multiple Files<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV class=Section1>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">Hi, 
  Michael:<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">&nbsp; 
  Sorry, but that is not entirely what I want. I was hoping to not just keep the 
  information but also the markup. Is there some way I can do 
  that?<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;This means that I should not 
  be using distinct-values() because it is similar to &lt;xsl:value-of 
  select=""&gt; as in XSLT, right?<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">Here 
  is the code again:<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">declare boundary-space 
  preserve;<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">&lt;book&gt;<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">{<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">let 
  $sorted_result:= for $doc in<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">distinct-values((doc("1.xml"),doc("3.xml"),<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">doc("4.xml"), 
  doc("2.xml"))//ad/p/address)<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">order 
  by $doc ascending<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">return 
  $doc<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">for 
  $sorted_results at $count in $sorted_result<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">return<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">&lt;bibl&gt;<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">&lt;statistics&gt;Showing Result: 
  {$count} / {count($sorted_result)}<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">&lt;/statistics&gt;<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">{$sorted_result}<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">&lt;/bibl&gt;<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">}<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">&lt;/book&gt;<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">Thanks 
  for your help.<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">======================================================<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">Alice 
  Wei<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">MIS 
  2008<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'">School 
  of Library and Information Science<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'">Indiana University 
  Bloomington<o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'"><A 
  href="mailto:ajwei@indiana.edu">ajwei@indiana.edu</A><o:p></o:p></SPAN></P>
  <P class=MsoPlainText><SPAN 
  style="FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
  <P class=MsoPlainText>-----Original Message-----<BR>From: Michael Kay 
  [mailto:mike@saxonica.com] <BR>Sent: Monday, January 21, 2008 4:04 PM<BR>To: 
  Wei, Alice J.; 'Liam Quin'<BR>Cc: talk@x-query.com<BR>Subject: RE: 
  [xquery-talk] Query Through Multiple Files<o:p></o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P>
  <P class=MsoPlainText>&gt; I tried using<o:p></o:p></P>
  <P class=MsoPlainText>&gt; distinct-values(doc("1.xml"), doc("3.xml"), 
  doc("4.xml"),<o:p></o:p></P>
  <P class=MsoPlainText>&gt; doc("2.xml"))//title, but I got the error that 
  there should<o:p></o:p></P>
  <P class=MsoPlainText>&gt; be only 2 arguments.<o:p></o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P>
  <P class=MsoPlainText>You didn't read my example carefully 
  enough<o:p></o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P>
  <P class=MsoPlainText>distinct-values(( doc("1.xml"),<o:p></o:p></P>
  <P class=MsoPlainText>&nbsp; doc("2.xml"),<o:p></o:p></P>
  <P class=MsoPlainText>&nbsp; doc("3.xml"),<o:p></o:p></P>
  <P class=MsoPlainText>&nbsp; doc("4.xml"))//ad)<o:p></o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P>
  <P class=MsoPlainText>Firstly, you want to find the set of titles and then 
  take the distinct<o:p></o:p></P>
  <P class=MsoPlainText>values in this set: so the "//title" part needs to 
  inside the argument to<o:p></o:p></P>
  <P class=MsoPlainText>distinct-values(). The way you've written it, you're 
  taking four documents,<o:p></o:p></P>
  <P class=MsoPlainText>then eliminating duplicates, then taking the title 
  elements within those<o:p></o:p></P>
  <P class=MsoPlainText>that are left.<o:p></o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P>
  <P class=MsoPlainText>Secondly, if you supply a sequence to a function that 
  expects a single<o:p></o:p></P>
  <P class=MsoPlainText>argument then you need to double the parentheses, for 
  example<o:p></o:p></P>
  <P class=MsoPlainText>sum((1,2,3,4,5)) or distinct-values((1,2,2,4,4)). That's 
  to make it clear<o:p></o:p></P>
  <P class=MsoPlainText>you are passing one argument which is a sequence of five 
  integers, not five<o:p></o:p></P>
  <P class=MsoPlainText>arguments that are single integers. IN your case you've 
  called<o:p></o:p></P>
  <P class=MsoPlainText>distinct-values() with four arguments, rather than with 
  a single argument<o:p></o:p></P>
  <P class=MsoPlainText>that is a sequence.<o:p></o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P>
  <P class=MsoPlainText>Michael Kay<o:p></o:p></P>
  <P class=MsoPlainText>http://www.saxonica.com/<o:p></o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P>
  <P class=MsoPlainText><o:p>&nbsp;</o:p></P></DIV></BLOCKQUOTE></BODY></HTML>