<!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> </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> </DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2><?xml version="1.0"
encoding="UTF-8"?></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2><xsd:schema xmlns:xsd="<A
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"<BR>
targetNamespace="<A
href="http://www.asdf.com/">http://www.asdf.com/</A>"<BR>
elementFormDefault="qualified"<BR> xmlns:asdf="<A
href="http://www.asdf.com/">http://www.asdf.com/</A>"></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2><xsd:element name="doc"><BR>
<xsd:complexType><BR> <xsd:choice
maxOccurs="unbounded"><BR> <xsd:element
name="a" type="asdf:type1"/><BR>
<xsd:element name="b" type="asdf:type2"/><BR>
</xsd:choice><BR>
</xsd:complexType><BR></xsd:element>
<BR> <BR><xsd:simpleType
name="type1"><BR> <xsd:restriction
base="xsd:integer"/><BR></xsd:simpleType></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2><xsd:simpleType name="type2"><BR>
<xsd:restriction
base="xsd:date"/><BR></xsd:simpleType></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2></xsd:schema></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </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> </DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2><doc xmlns="<A
href="http://www.asdf.com/">http://www.asdf.com/</A>"><BR>
<a>1234</a><BR> <a>5678</a><BR>
<b>2007-06-08</b><BR></doc></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </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> </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> </DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2>for $elem in */* return<BR> typeswitch
($elem)<BR> case element(*, asdf:type1) return element type1
{}<BR> case element(*, asdf:type2) return element type2
{}<BR> 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> </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> </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 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> </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> </DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2><?xml version="1.0"
encoding="UTF-8"?><BR><type1/><BR><type1/><BR><type2/></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=281410609-08062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </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> </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> </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>