<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR>
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-compose
}
DIV.Section1 {
        page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>When you write the expression</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>if (@x = ('apple', 'pear', 'orange')) then &lt;e/&gt; else 
&lt;f/&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>this is what happens.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>1. The expression @x is evaluated. The result of this 
expression is a sequence containing a single attribute node.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>2. The result of (1) is atomized. If there is no schema, 
the result is a sequence containing a single atomic value of type 
xs:untypedAtomic. If there is a schema, however, that describes the type of @x 
as xs:NMTOKENS and the actual value of @x is "banana cherry", then the result of 
atomization is a sequence of two (atomic) xs:NMTOKEN values.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>3. The result of (2) is compared with the 
sequence-of-strings ('apple', 'pear', 'orange')</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>4. The result of the comparison in (3) is a sequence 
containing a single xs:boolean value</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>I hope this shows how values consisting of nodes and values 
consisting of atomic values interact, and how atomic values can exist 
independently of nodes. In fact, XPath 1.0 allowed either sets of nodes, or 
singleton atomic values. XPath 2.0 has generalized this to also allow 
sets/sequences of atomic values, and singleton nodes.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>In this example there are no heterogeneous sequences, but 
they can arise and they can be very useful. Here's a&nbsp;handy 
example:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>&lt;e status="{(@status, 
'n/a')[1]}"/&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>which sets the value of the status attribute on the new 
element to a copy of the status attribute of the context node if it exists, or 
to the string 'n/a' otherwise. This involves a filter expression in which the 
sequence being filtered contains an attribute node and a 
string.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>Hope this helps!</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2>Michael Kay</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=675365920-07052007><FONT face=Arial 
color=#0000ff size=2><A 
href="http://www.saxonica.com/">http://www.saxonica.com/</A></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> talk-bounces@x-query.com 
  [mailto:talk-bounces@x-query.com] <B>On Behalf Of </B>Smith, Donald 
  T.<BR><B>Sent:</B> 07 May 2007 21:29<BR><B>To:</B> 
  talk@x-query.com<BR><B>Subject:</B> [xquery-talk] items as nodes or atomic 
  values<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV class=Section1>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">This may be a well-worn question. 
  If so, please point me to the location of the discussion. Otherwise. . 
  .<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I&#8217;m thinking through the 
  XQuery/XPath data model. The last paragraph in section 3.0 has me puzzling: 
  &#8220;</SPAN></FONT><SPAN lang=EN>The data model also supports values that are not 
  nodes. Examples of these are sequences of <A title="atomic value" 
  href="http://www.w3.org/TR/2007/REC-xpath-datamodel-20070123/#dt-atomic-value#dt-atomic-value">atomic 
  values</A>, or sequences mixing nodes and atomic values. These are necessary 
  to be able to represent the results of intermediate expressions in the data 
  model during expression processing.</SPAN><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&#8221;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I&#8217;m accustomed, from XPath 1.0, 
  &nbsp;to thinking of trees of nodes, so I&#8217;m not quite getting what it means to 
  have items in sequences that are either nodes or atomic values. Since an 
  atomic value is a string that conforms to an atomic type, atomic types are 
  schema-defined, and nodes may or may not have schema-defined datatypes, I 
  don&#8217;t understand the case where an atomic type would not be associated with &#8211; 
  and so represented by -- a node. In other words, I can&#8217;t image a XQuery/XPath 
  sequence as anything other than a node tree, which clearly shows I&#8217;m still in 
  XPath 1.0 land.<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">The last line I quoted above 
  indicates that this whole issue arises from something that goes on during 
  expression processing, so perhaps this is an issue that only matters to those 
  who write XQuery/XPath engines. At any rate, if anyone can clarify this issue 
  for me, I&#8217;d appreciate it.<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Don 
  Smith</SPAN></FONT><o:p></o:p></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Information 
  Architect<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">American 
  Airlines<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">817-967-0310</SPAN></FONT><o:p></o:p></P>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTML>