<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16441" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>Here is a working example for Saxon-SA.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>Schema test.xsd:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>&lt;?xml version="1.0" 
encoding="UTF-8"?&gt;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>&lt;xsd:schema xmlns:xsd="<A 
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"<BR>&nbsp; 
targetNamespace="<A 
href="http://www.asdf.com/">http://www.asdf.com/</A>"<BR>&nbsp; 
elementFormDefault="qualified"<BR>&nbsp; xmlns:asdf="<A 
href="http://www.asdf.com/">http://www.asdf.com/</A>"&gt;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>&lt;xsd:element name="doc"&gt;<BR>&nbsp; 
&lt;xsd:complexType&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;xsd:choice 
maxOccurs="unbounded"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element 
name="a" type="asdf:type1"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;xsd:element name="b" type="asdf:type2"/&gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;/xsd:choice&gt;<BR>&nbsp; 
&lt;/xsd:complexType&gt;<BR>&lt;/xsd:element&gt;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&lt;xsd:simpleType 
name="type1"&gt;<BR>&nbsp; &lt;xsd:restriction 
base="xsd:integer"/&gt;<BR>&lt;/xsd:simpleType&gt;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>&lt;xsd:simpleType name="type2"&gt;<BR>&nbsp; 
&lt;xsd:restriction 
base="xsd:date"/&gt;<BR>&lt;/xsd:simpleType&gt;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>&lt;/xsd:schema&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>Source test.xml:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>&lt;doc xmlns="<A 
href="http://www.asdf.com/">http://www.asdf.com/</A>"&gt;<BR>&nbsp; 
&lt;a&gt;1234&lt;/a&gt;<BR>&nbsp; &lt;a&gt;5678&lt;/a&gt;<BR>&nbsp; 
&lt;b&gt;2007-06-08&lt;/b&gt;<BR>&lt;/doc&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>Query test.xq:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>import schema namespace asdf = "<A 
href="http://www.asdf.com/">http://www.asdf.com/</A>" at 
"test.xsd";</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>for $elem in */* return<BR>&nbsp;&nbsp;typeswitch 
($elem)<BR>&nbsp;&nbsp;case element(*, asdf:type1) return element type1 
{}<BR>&nbsp;&nbsp;case element(*, asdf:type2) return element type2 
{}<BR>&nbsp;&nbsp;default return element default {}</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>Command line:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>java -cp 
c:\saxon-build\8.9.0.3\saj\saxon8sa.jar;c:\saxon-licenses net.sf.saxon.Query -sa 
-val -s&nbsp; test.xml test.xq</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>Output:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>&lt;?xml version="1.0" 
encoding="UTF-8"?&gt;<BR>&lt;type1/&gt;<BR>&lt;type1/&gt;<BR>&lt;type2/&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>The easiest way to get it wrong is to forget to ask for the 
input document to be validated (-val option).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2>Michael Kay</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2><A 
href="http://www.saxonica.com/">http://www.saxonica.com/</A></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV><BR>
<BLOCKQUOTE 
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>Vitali 
  Gontsharuk<BR><B>Sent:</B> 08 June 2007 08:24<BR><B>To:</B> 
  talk@x-query.com<BR><B>Subject:</B> [xquery-talk] Galax, XQuery! and schema 
  type matching<BR></FONT><BR></DIV>
  <DIV></DIV>Hello!<BR><BR>I'm having two problems which I could not solve until 
  now.<BR><BR>The first problem is the following: schema type matching doesn't 
  work for me in typeswitch constructs. By that I mean constructs of the 
  following form: <BR><BR>typeswitch ($elem)<BR>case element(*, asdf:type1) 
  return element type1 {}<BR>case element(*, asdf:type2) return element type2 
  {}<BR>default return element default {}<BR><BR>Here, asdf is the namespace 
  prefix of the imported schema. I've tried this both with the schema-aware 
  version of saxon and with Galax. I'm doing this the way this is described in 
  the XQuery spec. Could someone please point me to the problem by giving a 
  working example. Because Saxon is a 100% standard-conform XQuery 
  implementation, I assume that I've made some syntactical mistake. <BR><BR>The 
  second problem is about the XQuery! implementation in Galax. I'm using this 
  XQuery extension to make changes in the XML node sets but this doesn't work 
  for me. Here is the example which I'm testing with. It has been published in a 
  presentation by Jerome Simeon (one of the leaders of the Galax project). Here 
  is the script: <BR><BR><PRE>(: Declare our counter :)<BR>declare variable $counter := element counter { 0 };<BR><BR>(: Increment the counter :)<BR>declare function local:getnext() as xs:integer {<BR> replace { $counter/node() } with { $counter/node() + 1 },
<BR> $counter<BR>};</PRE>I'm getting the following error:<BR><PRE>Lexing Error: 3 Found QName while in operator state [File "bib.xq", line 6,<BR><BR>characters 9-10:]</PRE>I'm 
  using the following command to interpret this script: <BR><PRE>galax-run -output-xml bib.xml.result.xml -language xquerybang bib.xq</PRE>Here 
  is the link to the presentation by Jerome Simeon from which I extracted the 
  above sample script:<BR><A 
  href="http://xquerybang.cs.washington.edu/papers/xquerybang-psd.pdf">http://xquerybang.cs.washington.edu/papers/xquerybang-psd.pdf</A><BR><BR>I 
  will be thankful for any hint from your side! I already tried posting this 
  problem to the galax mailing list but didn't get any answer. The activity of 
  the project seems to be down somehow... There was also no reaction to my bug 
  report in their bugzilla for about two weeks. Does anyone know about the 
  status of the project? There has still been an update of galax in February 
  2007, so someone is still working on it... <BR><BR>I would also be thankful 
  for the current state of the XQuery update facility implementations or 
  implementations of some alternative XQuery update extension.<BR><BR>Thanks in 
  advance for your answers!<BR>Vitali Gontsharuk <BR></BLOCKQUOTE></BODY></HTML>