From olivier at xmlmind.com Tue Dec 2 12:52:00 2008
From: olivier at xmlmind.com (Olivier Ishacian)
Date: Tue Dec 2 03:49:04 2008
Subject: [xquery-talk] [ANN] Qizx 2.2 released
Message-ID: <49352160.6000609@xmlmind.com>
XMLmind is happy to announce the version 2.2
of Qizx and Qizx/open.
Qizx Free Engine can be downloaded from
http://www.xmlmind.com/qizx/download.shtml
Qizx/open can be downloaded from
http://www.xmlmind.com/qizx/qizxopen.shtml
Qizx customers, please upgrade using this form:
http://www.xmlmind.com/store/download.php
(The above form is usually accessed through
http://www.xmlmind.com/qizx/upgrade.html.)
---------------------------------------------
Qizx is an embeddable, high-speed, native XML
indexing and query engine written in Java(TM),
with the querying and processing capabilities of a
fully fledged XML Query implementation.
New features in version 2.2:
* Support of XQuery 1.1 features: "group by" and
"for ... window" clauses in FLWOR expressions.
* New liberal licensing scheme: Server, Site and
Developer licenses.
The full source code can now be purchased.
Please visit http://www.xmlmind.com/qizx/changes.html
for more information.
Qizx is available in several editions:
* The commercial product has 3 liberal licenses
both for corporate application development, and
for royalty-free distributable products.
* The Free Engine edition is a fully functional
version of Qizx which can be used for developing
or in production. It is limited in database
size (one gigabyte of XML approximately).
* Qizx/open is an open-source version of the XML
Query interpreter of Qizx. Qizx/open has been
available since 2003 and is recognized as one of
the fastest and most advanced XML Query
implementations.
Please visit http://www.xmlmind.com/qizx/ for more
information about Qizx.
From matthew at stickledown.com Fri Dec 12 11:27:27 2008
From: matthew at stickledown.com (Matthew Rawlings)
Date: Fri Dec 12 03:23:32 2008
Subject: [xquery-talk] count all the distinct timezones in an XML document
using XPath
Message-ID: <6089ED2307854EACA58C9ADC38441542@ORAC>
How can I count all the distinct timezones in a single XML document using
XPath?
I have an XML document with many elements and attributes with the type
xs:date or xs:datetime. One of the rules of the system receiving my document
is that all timezones must be the same in the document. Ideally I would like
to express this constraint purely in XPath 2 rather than XQuery so I can put
the constraint in a xs:assert statement.
If there was a map function in XPath I would write something like this:
count(distinct-values(map(fn:date-from-timezone(), //(element(*,
xs:date)|attribute(*, xs:date)|element(*, xs:datetime)|attribute(*,
xs:datetime))))) eq 1
This XPath would return true if all timezones were the same, and false
otherwise.
However there is no map function in XPath, so how can I achieve the same
thing without it? What is the nearest I could get.
- Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081212/bb43b052/attachment.htm
From davidc at nag.co.uk Fri Dec 12 11:42:09 2008
From: davidc at nag.co.uk (David Carlisle)
Date: Fri Dec 12 03:38:11 2008
Subject: [xquery-talk] count all the distinct timezones in an XML document
using XPath
In-Reply-To: <6089ED2307854EACA58C9ADC38441542@ORAC> (matthew@stickledown.com)
References: <6089ED2307854EACA58C9ADC38441542@ORAC>
Message-ID: <200812121142.mBCBg9KY020254@edinburgh.nag.co.uk>
count(distinct-values(//(element(*,
xs:date)|attribute(*, xs:date)|element(*, xs:datetime)|attribute(*,
xs:datetime))/date-from-timezone(.))) eq 1
> If there was a map function in XPath
in simple cases (as here) you can use / as map otherwise a for clause
serves that purpose.
your map(f,seq) is
for $s in seq return f($s)
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
From mike at saxonica.com Fri Dec 12 11:48:15 2008
From: mike at saxonica.com (Michael Kay)
Date: Fri Dec 12 03:44:22 2008
Subject: [xquery-talk] count all the distinct timezones in an XML
documentusing XPath
In-Reply-To: <6089ED2307854EACA58C9ADC38441542@ORAC>
References: <6089ED2307854EACA58C9ADC38441542@ORAC>
Message-ID: <2410B53C480E41D0AD03237E62AA430B@Sealion>
The nearest to a map() function is the "for" expression
count(distinct-values(for $x in //element(*, xs:date) return
timezone-from-date($x),
for $x in //element(*, xs:dateTime) return
timezone-from-dateTime($x),
for $x in //element(*, xs:time) return
timezone-from-time($x))) eq 1
But there is also the "simple mapping operator" "/" -
//element(*,xs:date)/timezone-from-date(.)
It's rather tedious that there's no polymorphism (or support of union types)
so that the different date/time types have to be enumerated like this.
Note that if a dateTime has no timezone, timezone-from-dateTime() will
return (), which is ignored in counting the distinct values.
Michael Kay
http://www.saxonica.com/
_____
From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf
Of Matthew Rawlings
Sent: 12 December 2008 11:27
To: talk@x-query.com
Subject: [xquery-talk] count all the distinct timezones in an XML
documentusing XPath
How can I count all the distinct timezones in a single XML document using
XPath?
I have an XML document with many elements and attributes with the type
xs:date or xs:datetime. One of the rules of the system receiving my document
is that all timezones must be the same in the document. Ideally I would like
to express this constraint purely in XPath 2 rather than XQuery so I can put
the constraint in a xs:assert statement.
If there was a map function in XPath I would write something like this:
count(distinct-values(map(fn:date-from-timezone(), //(element(*,
xs:date)|attribute(*, xs:date)|element(*, xs:datetime)|attribute(*,
xs:datetime))))) eq 1
This XPath would return true if all timezones were the same, and false
otherwise.
However there is no map function in XPath, so how can I achieve the same
thing without it? What is the nearest I could get.
- Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081212/4c872ada/attachment.htm
From matthew at stickledown.com Fri Dec 12 13:05:05 2008
From: matthew at stickledown.com (Matthew Rawlings)
Date: Fri Dec 12 05:05:46 2008
Subject: [xquery-talk] count all the distinct timezones in an
XMLdocumentusing XPath
In-Reply-To: <2410B53C480E41D0AD03237E62AA430B@Sealion>
Message-ID: <4AD813BA03E6443E8C9909B760FE7809@ORAC>
Thanks to David Carlisle and Mike Kay I found my mistakes and solved the
problem. The final form of the XPath I used is below:
count(distinct-values(//((element(*, xs:date)|attribute(*,
xs:date))/timezone-from-date(.),(element(*, xs:dateTime)|attribute(*,
xs:dateTime))/timezone-from-dateTime(.)))) eq 1
I am glad I can express it in pure XPath rather than XQuery as then I can
use it in a xs:assert in a schema written in XML Schema 1.1.
I agree with Mike's point about polymorphism - why can't timezone-from-date
and timezone-from-dateTime be the one function with either a xs:date or
xs:dateTime parameter. Both functions return a xs:duration and do the same
thing. It would make the XPath much simpler.
_____
From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf
Of Michael Kay
Sent: 12 December 2008 11:48
To: 'Matthew Rawlings'; talk@x-query.com
Subject: RE: [xquery-talk] count all the distinct timezones in an
XMLdocumentusing XPath
The nearest to a map() function is the "for" expression
count(distinct-values(for $x in //element(*, xs:date) return
timezone-from-date($x),
for $x in //element(*, xs:dateTime) return
timezone-from-dateTime($x),
for $x in //element(*, xs:time) return
timezone-from-time($x))) eq 1
But there is also the "simple mapping operator" "/" -
//element(*,xs:date)/timezone-from-date(.)
It's rather tedious that there's no polymorphism (or support of union types)
so that the different date/time types have to be enumerated like this.
Note that if a dateTime has no timezone, timezone-from-dateTime() will
return (), which is ignored in counting the distinct values.
Michael Kay
http://www.saxonica.com/
_____
From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf
Of Matthew Rawlings
Sent: 12 December 2008 11:27
To: talk@x-query.com
Subject: [xquery-talk] count all the distinct timezones in an XML
documentusing XPath
How can I count all the distinct timezones in a single XML document using
XPath?
I have an XML document with many elements and attributes with the type
xs:date or xs:datetime. One of the rules of the system receiving my document
is that all timezones must be the same in the document. Ideally I would like
to express this constraint purely in XPath 2 rather than XQuery so I can put
the constraint in a xs:assert statement.
If there was a map function in XPath I would write something like this:
count(distinct-values(map(fn:date-from-timezone(), //(element(*,
xs:date)|attribute(*, xs:date)|element(*, xs:datetime)|attribute(*,
xs:datetime))))) eq 1
This XPath would return true if all timezones were the same, and false
otherwise.
However there is no map function in XPath, so how can I achieve the same
thing without it? What is the nearest I could get.
- Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081212/8b4ef258/attachment-0001.htm
From davidc at nag.co.uk Fri Dec 12 13:31:18 2008
From: davidc at nag.co.uk (David Carlisle)
Date: Fri Dec 12 05:31:57 2008
Subject: [xquery-talk] count all the distinct timezones in an
XMLdocumentusing XPath
In-Reply-To: <4AD813BA03E6443E8C9909B760FE7809@ORAC> (matthew@stickledown.com)
References: <4AD813BA03E6443E8C9909B760FE7809@ORAC>
Message-ID: <200812121331.mBCDVIhr020760@edinburgh.nag.co.uk>
> Thanks to David Carlisle and Mike Kay I found my mistakes
Mike's response had the benefit of being right. I concentrated on the
map/for/(/) issue and didn't notice the need for separate date
extraction functions for the different types, sorry about that.
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
From andrew.j.welch at gmail.com Wed Dec 17 11:21:24 2008
From: andrew.j.welch at gmail.com (Andrew Welch)
Date: Wed Dec 17 03:19:45 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
Message-ID: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
Hi all,
This is surely a faq, but I'm interested in what people think is the
right approach for this...
The input is in no namespace, the required output is unprefixed xhtml:
....
{
for $x in collection(...)/path/to/node
For some reason the default namespace on the html element affects the
xpath - which is different to xslt and a little odd to me...
Is there something like xpath-default-namespace so I can clear the
default namespace for the xpaths?
thanks
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
From davidc at nag.co.uk Wed Dec 17 11:45:07 2008
From: davidc at nag.co.uk (David Carlisle)
Date: Wed Dec 17 03:43:29 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
(andrew.j.welch@gmail.com)
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
Message-ID: <200812171145.mBHBj75N012171@edinburgh.nag.co.uk>
> Is there something like xpath-default-namespace so I can clear the
> default namespace for the xpaths?
nope, I don't think so, you have to use the long form of element
constructor to put the namespace in each time (or use xslt:-)
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
From mike at saxonica.com Wed Dec 17 11:50:10 2008
From: mike at saxonica.com (Michael Kay)
Date: Wed Dec 17 03:48:36 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
Message-ID: <01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
>
> This is surely a faq, but I'm interested in what people think
> is the right approach for this...
>
> The input is in no namespace, the required output is unprefixed xhtml:
>
>
> ....
>
> {
> for $x in collection(...)/path/to/node
>
> For some reason the default namespace on the html element
> affects the xpath - which is different to xslt and a little
> odd to me...
>
> Is there something like xpath-default-namespace so I can
> clear the default namespace for the xpaths?
No, unfortunately not. I tried to get something like this in, but the
general tendency of the WG was resistance to making namespaces even more
complicated than they were already.
If you want the output to be in an unprefixed namespace, but the input is in
no namespace, then the only ways I know to achieve this are either
(a) to use computed element constructors to create all the output elements,
or
(b) to put all the path expressions into functions, rather than having them
nested within element constructors
I think it would have been better to have had two completely separate static
namespace contexts, one used for path expressions and one for constructed
elements, and for namespace declarations on constructed elements to affect
only the latter.
Michael Kay
http://www.saxonica.com/
From andrew.j.welch at gmail.com Wed Dec 17 13:33:51 2008
From: andrew.j.welch at gmail.com (Andrew Welch)
Date: Wed Dec 17 05:34:22 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
Message-ID: <74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
> nope, I don't think so
> No, unfortunately not
Thanks for the replies, that's a shame... (and unfortunate that it's
not consistent with xslt )
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
From jesper.tverskov at gmail.com Wed Dec 17 14:55:26 2008
From: jesper.tverskov at gmail.com (Jesper Tverskov)
Date: Wed Dec 17 05:55:57 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
<74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
Message-ID: <852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
I guess a wild card prefix would do as explained in my tutorial
"Creating XHTML with XQuery", http://www.xmlplease.com/xquery-xhtml.
for $x in collection(...)/*:path/*:to/*:node
Cheers,
Jesper Tverskov
http://www.xmlplease.com
From andrew.j.welch at gmail.com Wed Dec 17 14:08:45 2008
From: andrew.j.welch at gmail.com (Andrew Welch)
Date: Wed Dec 17 06:09:15 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
<74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
<852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
Message-ID: <74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
Yeah I saw that, thanks, but it's not really a reasonble solution...
(in my humble opinion)
I will go with xquery building the input to a transform which
generates the xhtml, which is probably a nicer solution than using
just xquery anyway.
I was going to say that generating xhtml should be the #1 use case,
but I guess using it in that way wasn't really expected?
2008/12/17 Jesper Tverskov :
> I guess a wild card prefix would do as explained in my tutorial
> "Creating XHTML with XQuery", http://www.xmlplease.com/xquery-xhtml.
>
>
> for $x in collection(...)/*:path/*:to/*:node
>
>
> Cheers,
>
> Jesper Tverskov
> http://www.xmlplease.com
> _______________________________________________
> talk@x-query.com
> http://x-query.com/mailman/listinfo/talk
>
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
From michael.blakeley at marklogic.com Wed Dec 17 06:51:10 2008
From: michael.blakeley at marklogic.com (Michael Blakeley)
Date: Wed Dec 17 06:51:41 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com> <01D0E327AEC14D6BA40D28D092B9EB94@Sealion> <74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com> <852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
<74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
Message-ID: <494911DE.10404@marklogic.com>
Andrew,
I don't like the '*:foo' shortcut either - it's nice for debugging, but
it's a red flag when I'm doing code reviews.
The empty-namespace problem is much easier to work around than the
earlier responses imply. The trick is to understand that every XPath
expression evaluates in the current scope's default element namespace,
but you can control the scope's default element namespace.
http://marklogic.markmail.org/search/?q=namespace turns up some similar
discussion threads.
I'll use MarkLogic Server 4.0 with cq as the query interface, and start
with a standalone test case to show the problem:
xquery version "1.0";
declare variable $INPUT as document-node() := document {
hello andrew
,
hello world
};
{
for $x in $INPUT/path/to/node
order by $x
return element span { text { $x } }
}
=>
The result includes no spans, because $INPUT/path/to/node is looking for
'path' etc in the xhtml namespace. Now let's try my preferred technique
- a function call. This test will use a local function, but we could
also use a library function. Either way, the function body starts with
the same default element namespace as the XQuery module scope.
xquery version "1.0";
declare variable $INPUT as document-node() := document {
hello andrew
,
hello world
};
declare function local:get-nodes()
as element(node)+
{
$INPUT/path/to/node
};
{
for $x in local:get-nodes()
order by $x
return element span { text { $x } }
}
=>
hello andrewhello world
That works, and it's my preferred solution. But here's another one, if
you don't want to define a function:
...
{
{
for $x in $INPUT/path/to/node
order by $x
return element span { text { $x } }
}/node()
}
=>
hello andrewhello world
I'm sure there are other approaches, but those are the two that came to
mind. Hope that helps.
-- Mike
On 2008-12-17 06:08, Andrew Welch wrote:
> Yeah I saw that, thanks, but it's not really a reasonble solution...
> (in my humble opinion)
>
> I will go with xquery building the input to a transform which
> generates the xhtml, which is probably a nicer solution than using
> just xquery anyway.
>
> I was going to say that generating xhtml should be the #1 use case,
> but I guess using it in that way wasn't really expected?
>
>
>
> 2008/12/17 Jesper Tverskov:
>> I guess a wild card prefix would do as explained in my tutorial
>> "Creating XHTML with XQuery", http://www.xmlplease.com/xquery-xhtml.
>>
>>
>> for $x in collection(...)/*:path/*:to/*:node
>>
>>
>> Cheers,
>>
>> Jesper Tverskov
>> http://www.xmlplease.com
>> _______________________________________________
>> talk@x-query.com
>> http://x-query.com/mailman/listinfo/talk
>>
>
>
>
From andrew.j.welch at gmail.com Wed Dec 17 15:20:51 2008
From: andrew.j.welch at gmail.com (Andrew Welch)
Date: Wed Dec 17 07:21:22 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <494911DE.10404@marklogic.com>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
<74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
<852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
<74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
<494911DE.10404@marklogic.com>
Message-ID: <74a894af0812170720j175413f9q789cf82be0dfd9fc@mail.gmail.com>
Thanks, but I would say neither is a reasonable approach...
I think it's best to leave the xhtml generation to xslt.
2008/12/17 Michael Blakeley :
> Andrew,
>
> I don't like the '*:foo' shortcut either - it's nice for debugging, but it's
> a red flag when I'm doing code reviews.
>
> The empty-namespace problem is much easier to work around than the earlier
> responses imply. The trick is to understand that every XPath expression
> evaluates in the current scope's default element namespace, but you can
> control the scope's default element namespace.
> http://marklogic.markmail.org/search/?q=namespace turns up some similar
> discussion threads.
>
> I'll use MarkLogic Server 4.0 with cq as the query interface, and start with
> a standalone test case to show the problem:
>
> xquery version "1.0";
>
> declare variable $INPUT as document-node() := document {
>
> hello andrew
> ,
>
> hello world
>
> };
>
>
>
>
> {
> for $x in $INPUT/path/to/node
> order by $x
> return element span { text { $x } }
> }
>
>
>
> =>
>
>
>
>
>
>
> The result includes no spans, because $INPUT/path/to/node is looking for
> 'path' etc in the xhtml namespace. Now let's try my preferred technique - a
> function call. This test will use a local function, but we could also use a
> library function. Either way, the function body starts with the same default
> element namespace as the XQuery module scope.
>
> xquery version "1.0";
>
> declare variable $INPUT as document-node() := document {
>
> hello andrew
> ,
>
> hello world
>
> };
>
> declare function local:get-nodes()
> as element(node)+
> {
> $INPUT/path/to/node
> };
>
>
>
>
> {
> for $x in local:get-nodes()
> order by $x
> return element span { text { $x } }
> }
>
>
>
> =>
>
>
> hello andrewhello world
>
>
>
> That works, and it's my preferred solution. But here's another one, if you
> don't want to define a function:
>
> ...
>
>
>
> {
> {
> for $x in $INPUT/path/to/node
> order by $x
> return element span { text { $x } }
> }/node()
> }
>
>
>
> =>
>
>
> hello andrewhello world
>
>
>
> I'm sure there are other approaches, but those are the two that came to
> mind. Hope that helps.
>
> -- Mike
>
> On 2008-12-17 06:08, Andrew Welch wrote:
>>
>> Yeah I saw that, thanks, but it's not really a reasonble solution...
>> (in my humble opinion)
>>
>> I will go with xquery building the input to a transform which
>> generates the xhtml, which is probably a nicer solution than using
>> just xquery anyway.
>>
>> I was going to say that generating xhtml should be the #1 use case,
>> but I guess using it in that way wasn't really expected?
>>
>>
>>
>> 2008/12/17 Jesper Tverskov:
>>>
>>> I guess a wild card prefix would do as explained in my tutorial
>>> "Creating XHTML with XQuery", http://www.xmlplease.com/xquery-xhtml.
>>>
>>>
>>> for $x in collection(...)/*:path/*:to/*:node
>>>
>>>
>>> Cheers,
>>>
>>> Jesper Tverskov
>>> http://www.xmlplease.com
>>> _______________________________________________
>>> talk@x-query.com
>>> http://x-query.com/mailman/listinfo/talk
>>>
>>
>>
>>
>
> _______________________________________________
> talk@x-query.com
> http://x-query.com/mailman/listinfo/talk
>
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
From Andy.K.Chang at aexp.com Wed Dec 17 14:03:07 2008
From: Andy.K.Chang at aexp.com (Andy K Chang)
Date: Wed Dec 17 13:03:40 2008
Subject: [xquery-talk] Andy K Chang is out of office
Message-ID:
I will be out of the office starting 12/16/2008 and will not return until
01/05/2009.
Hi,
I will be out of office from 12/16/08 till 01/04/09. Returing on 01/05/09.
During this time, I will have no delegate. But I will be available via my
cell: 480-203-3964 should there be any urgent matter. Have a Happy and Save
Holiday. See you in 2009!!!
American Express made the following annotations on Wed Dec 17 2008 14:03:02
------------------------------------------------------------------------------
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
American Express a ajouté le commentaire suivant le Wed Dec 17 2008 14:03:02
Ce courrier et toute pièce jointe qu'il contient sont réservés au seul destinataire indiqué et peuvent renfermer des renseignements confidentiels et privilégiés. Si vous n'êtes pas le destinataire prévu, toute divulgation, duplication, utilisation ou distribution du courrier ou de toute pièce jointe est interdite. Si vous avez reçu cette communication par erreur, veuillez nous en aviser par courrier et détruire immédiatement le courrier et les pièces jointes. Merci.
******************************************************************************
-------------------------------------------------------------------------------
From matthew at stickledown.com Thu Dec 18 02:15:30 2008
From: matthew at stickledown.com (Matthew Rawlings)
Date: Thu Dec 18 02:11:45 2008
Subject: [xquery-talk] collection-node()
Message-ID: <20081218021530.19794x35rprkfthc@www.kattare.com>
Why does XQuery not have a collection node?
I end up writing \"document-node()*\" to represent a collection,
rather than use something akin to \"collection-node()\".
I hope that by understanding the XQuery design decision I could
improve my XQuery.
- Matthew
From mike at saxonica.com Thu Dec 18 10:52:29 2008
From: mike at saxonica.com (Michael Kay)
Date: Thu Dec 18 02:48:52 2008
Subject: [xquery-talk] collection-node()
In-Reply-To: <20081218021530.19794x35rprkfthc@www.kattare.com>
References: <20081218021530.19794x35rprkfthc@www.kattare.com>
Message-ID:
>
> Why does XQuery not have a collection node?
>
We did consider at one time making collections into first-class objects. I
think the reason it didn't happen was simply that it looked like a lot of
work for a relatively small advantage.
If a collection is a node, then it's rather different from other kinds of
node. Documents can belong to more than one collection, and the documents in
a collection are unordered. (Would the documents in a collection be children
of the collection node? In that case, would they be siblings of each
other?...)
One of the questions we didn't want to answer was whether collections can
contain other collections. Different XML databases have different answers to
that question and it would therefore have absorbed a lot of WG time.
Someone suggested, wisely I think, that it would be a good idea to see what
implementors did with the concept of a collection, see what kind of
consensus emerged, and if there was enough commonality, the WG could then
consider standardizing the functionality further.
Michael Kay
http://www.saxonica.com/
From jesper.tverskov at gmail.com Thu Dec 18 14:15:58 2008
From: jesper.tverskov at gmail.com (Jesper Tverskov)
Date: Thu Dec 18 05:16:07 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <74a894af0812170720j175413f9q789cf82be0dfd9fc@mail.gmail.com>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
<74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
<852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
<74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
<494911DE.10404@marklogic.com>
<74a894af0812170720j175413f9q789cf82be0dfd9fc@mail.gmail.com>
Message-ID: <852456e80812180515j19cdeb9ch8265ef4988def75@mail.gmail.com>
As has been said, there are many more or less cumbersome ways to
output XHTML from XML input in no namespace, most of them bad in my
opinion because they smell to much of fancy work-arounds and not that
easy to reuse.
The only correct way, I feel, is to "use the long form of element
constructor to put the namespace in each time", as Carlisle formulated
it. I tried it out, it works, naturally, but it is a hell of a lot
work.
So I came up with the following method, nice because there is some
natural logic to it, now when it not possible to do it directly. Also,
most of all, it is nice because it is easy to reuse.
1) Declare the following change-namespace function (borrowed
unchanged from Priscilla Walmsley):
declare namespace functx = "http://www.functx.com";
declare function functx:change-element-ns-deep
($element as element(), $newns as xs:string) as element() {
let $newName := QName($newns, local-name($element))
return (element {$newName}
{$element/@*,
for $child in $element/node()
return if ($child instance of element())
then functx:change-element-ns-deep($child, $newns)
else $child
}
)
};
2) Create a variable $x and put good old XHTML output, build the
literal way, into it. The only thing that is missing is
xmlns="http://www.w3.org/1999/xhtml" in the html element.
3) Now use the following:
functx:change-element-ns-deep($x, "http://www.w3.org/1999/xhtml")
Cheers,
Jesper Tverskov
http://www.xmlplease.com
From davidc at nag.co.uk Thu Dec 18 13:32:29 2008
From: davidc at nag.co.uk (David Carlisle)
Date: Thu Dec 18 05:32:42 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <852456e80812180515j19cdeb9ch8265ef4988def75@mail.gmail.com>
(jesper.tverskov@gmail.com)
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
<74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
<852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
<74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
<494911DE.10404@marklogic.com>
<74a894af0812170720j175413f9q789cf82be0dfd9fc@mail.gmail.com>
<852456e80812180515j19cdeb9ch8265ef4988def75@mail.gmail.com>
Message-ID: <200812181332.mBIDWT4q019909@edinburgh.nag.co.uk>
Yes you can do that, which is probably the nicest from the users point
of view, however it does mean (probably) that the entire output has to
be saved up in a variable and reprocessed which has memory implications
and also stops the serialiser serialising the output before the (main)
transform has finished. Restrictions such as the one not allowing you
to add attribute nodes after child nodes, are designed to allow the
system to serialise the output without ever actually building the
result tree.
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
From andrew.j.welch at gmail.com Thu Dec 18 13:45:32 2008
From: andrew.j.welch at gmail.com (Andrew Welch)
Date: Thu Dec 18 05:45:40 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <852456e80812180515j19cdeb9ch8265ef4988def75@mail.gmail.com>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
<74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
<852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
<74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
<494911DE.10404@marklogic.com>
<74a894af0812170720j175413f9q789cf82be0dfd9fc@mail.gmail.com>
<852456e80812180515j19cdeb9ch8265ef4988def75@mail.gmail.com>
Message-ID: <74a894af0812180545u1a8b57ftebae653e8a0f0b7d@mail.gmail.com>
Hi Jesper,
> 2) Create a variable $x and put good old XHTML output, build the
> literal way, into it. The only thing that is missing is
> xmlns="http://www.w3.org/1999/xhtml" in the html element.
>
> 3) Now use the following:
>
> functx:change-element-ns-deep($x, "http://www.w3.org/1999/xhtml")
It's probably the "least worst" so far :) but the output also contains
XForms, so the function would have to only change elements in no
namespace and not all of them...
It's crying out for an xpath-default-namespace facility - is there an
"XQuery 2" in the pipeline that vendors can implement parts of now to
solve common problems like this? (for example like Saxon provided
with the much needed xhtml output method way before xslt 2.0 was
finialised)
Or of course, the other "solution" is when xslt can operate directly
on the database (did I say that on this list? :)
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
From davidc at nag.co.uk Thu Dec 18 13:59:07 2008
From: davidc at nag.co.uk (David Carlisle)
Date: Thu Dec 18 05:59:17 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <74a894af0812180545u1a8b57ftebae653e8a0f0b7d@mail.gmail.com>
(andrew.j.welch@gmail.com)
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
<74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
<852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
<74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
<494911DE.10404@marklogic.com>
<74a894af0812170720j175413f9q789cf82be0dfd9fc@mail.gmail.com>
<852456e80812180515j19cdeb9ch8265ef4988def75@mail.gmail.com>
<74a894af0812180545u1a8b57ftebae653e8a0f0b7d@mail.gmail.com>
Message-ID: <200812181359.mBIDx7gG020095@edinburgh.nag.co.uk>
> is there an "XQuery 2" in the pipeline
no 1.1
http://www.w3.org/TR/xquery-11-requirements/
its a shame its not called 2, to get the xpath version number back in
sync.
see also
http://www.w3.org/Bugs/Public/show_bug.cgi?id=6131#c2
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
From mike at saxonica.com Thu Dec 18 14:08:19 2008
From: mike at saxonica.com (Michael Kay)
Date: Thu Dec 18 06:08:34 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <74a894af0812180545u1a8b57ftebae653e8a0f0b7d@mail.gmail.com>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com><01D0E327AEC14D6BA40D28D092B9EB94@Sealion><74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com><852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com><74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com><494911DE.10404@marklogic.com><74a894af0812170720j175413f9q789cf82be0dfd9fc@mail.gmail.com><852456e80812180515j19cdeb9ch8265ef4988def75@mail.gmail.com>
<74a894af0812180545u1a8b57ftebae653e8a0f0b7d@mail.gmail.com>
Message-ID:
> It's crying out for an xpath-default-namespace facility - is
> there an "XQuery 2" in the pipeline that vendors can
> implement parts of now to
> solve common problems like this?
There's an XQuery 1.1 in the pipeline: see
http://www.w3.org/TR/xquery-11/
It doesn't currently address this problem, and I don't think there is
anything in the requirements list to do so; it might be a good time to raise
a well-argued bug report. Pointing to the range of workarounds that people
are using might help to convince the WG that the problem is a real one.
Michael Kay
http://www.saxonica.com/
From andrew.j.welch at gmail.com Thu Dec 18 14:12:21 2008
From: andrew.j.welch at gmail.com (Andrew Welch)
Date: Thu Dec 18 06:12:30 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To: <200812181359.mBIDx7gG020095@edinburgh.nag.co.uk>
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
<74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
<852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
<74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
<494911DE.10404@marklogic.com>
<74a894af0812170720j175413f9q789cf82be0dfd9fc@mail.gmail.com>
<852456e80812180515j19cdeb9ch8265ef4988def75@mail.gmail.com>
<74a894af0812180545u1a8b57ftebae653e8a0f0b7d@mail.gmail.com>
<200812181359.mBIDx7gG020095@edinburgh.nag.co.uk>
Message-ID: <74a894af0812180612l29935b1co567dddf926aa0af0@mail.gmail.com>
>> is there an "XQuery 2" in the pipeline
>
> no 1.1
>
> http://www.w3.org/TR/xquery-11-requirements/
>
> its a shame its not called 2, to get the xpath version number back in
> sync.
Agreed (if it's anything like xslt then 1.1 will be dropped in favour
of 2 so it might yet happen)
> see also
>
> http://www.w3.org/Bugs/Public/show_bug.cgi?id=6131#c2
ahh cool, thanks.
Scrolling up from that link is actually the key problem - and when
that gets solved namespaces will make a lot more sense, and be a lot
more useable.
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
From andrew.j.welch at gmail.com Thu Dec 18 14:13:32 2008
From: andrew.j.welch at gmail.com (Andrew Welch)
Date: Thu Dec 18 06:13:40 2008
Subject: [xquery-talk] Generating xhtml from xml in no namespace
In-Reply-To:
References: <74a894af0812170321o323c1daanfe30de96ed3bf49d@mail.gmail.com>
<01D0E327AEC14D6BA40D28D092B9EB94@Sealion>
<74a894af0812170533k1699b93ai5d26be8a0c50aac1@mail.gmail.com>
<852456e80812170555q57558dc7j12e9130b4194ec0e@mail.gmail.com>
<74a894af0812170608w231b6341uba0456e56717a8f4@mail.gmail.com>
<494911DE.10404@marklogic.com>
<74a894af0812170720j175413f9q789cf82be0dfd9fc@mail.gmail.com>
<852456e80812180515j19cdeb9ch8265ef4988def75@mail.gmail.com>
<74a894af0812180545u1a8b57ftebae653e8a0f0b7d@mail.gmail.com>
Message-ID: <74a894af0812180613n6357f2d9i1b724d3e8db520cf@mail.gmail.com>
2008/12/18 Michael Kay :
>> It's crying out for an xpath-default-namespace facility - is
>> there an "XQuery 2" in the pipeline that vendors can
>> implement parts of now to
>> solve common problems like this?
>
> There's an XQuery 1.1 in the pipeline: see
>
> http://www.w3.org/TR/xquery-11/
>
> It doesn't currently address this problem, and I don't think there is
> anything in the requirements list to do so; it might be a good time to raise
> a well-argued bug report. Pointing to the range of workarounds that people
> are using might help to convince the WG that the problem is a real one.
I'll leave that to someone who can fulfil the "well-argued" part...
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/