From adam.retter at googlemail.com Sat Jan 12 01:22:55 2019 From: adam.retter at googlemail.com (Adam Retter) Date: Sat, 12 Jan 2019 17:22:55 +0800 Subject: [xquery-talk] xs:error and AbstractTypes Message-ID: Whilst looking for a type which is declarable in XQuery but that cannot be constructed, I wrote a strange query, well to me anyway, which evaluates on Saxon 9.8.0.12 PE, and returns . declare function local:test1($x as xs:error) { }; local:test1(()) You can also modify the query so the parameter has one-or-mode cardinality e.g. "$x as xs:error+", and it will still evaluate with an empty sequence as the argument. I believe that this is because xs:error is always an empty type. BaseX and eXist-db both refuse to evaluate the query, saying that the type xs:error is unknown. Am I right in thinking that Saxon evaluates this because it supports [Schema 1.1 Part 2], whereas eXist-db and BaseX do not? Also if anyone has any bright ideas, about a type that I could explicitly declare for a function argument, but that CANNOT be constructed within XQuery, I would be interested to know. I think Union types are out as I want to support all processors (i.e. not require Schema support). So far I haven't seen anything... -- Adam Retter skype: adam.retter tweet: adamretter http://www.adamretter.org.uk From christian.gruen at gmail.com Sat Jan 12 03:08:25 2019 From: christian.gruen at gmail.com (=?UTF-8?Q?Christian_Gr=C3=BCn?=) Date: Sat, 12 Jan 2019 12:08:25 +0100 Subject: [xquery-talk] xs:error and AbstractTypes In-Reply-To: References: Message-ID: Hi Adam, > Am I right in thinking that Saxon evaluates this because it supports > [Schema 1.1 Part 2], whereas eXist-db and BaseX do not? This would be my guess, too. > Also if anyone has any bright ideas, about a type that I could > explicitly declare for a function argument, but that CANNOT be > constructed within XQuery, I would be interested to know. Apart from the general item() type, I can only think of xs:anyAtomicType: declare function local:test2($x as xs:anyAtomicType*) { }; local:test2(()) Cheers Christian From adam.retter at googlemail.com Sat Jan 12 06:24:46 2019 From: adam.retter at googlemail.com (Adam Retter) Date: Sat, 12 Jan 2019 22:24:46 +0800 Subject: [xquery-talk] XQuery Function Annotations... and XSLT Message-ID: Does anyone know if there is something similar in XSLT to XQuery 3.0's Annotations? I am developing a set of XPath functions, which produce functions. These produced functions can benefit from being treated in a certain manner by a processor. I was thinking of using custom Annotations to label the produced functions, so that a processor would have more information about how they should be evaluated. Unfortunately I just realised that Annotations are defined in the XQuery spec, not the lower XPath spec (as I had assumed). Is there anything equivalent for functions (produced by functions) in XSLT? p.s. I will crosspost to the mulberry XSLT list as this seems relevant to both. Thanks Adam. -- Adam Retter skype: adam.retter tweet: adamretter http://www.adamretter.org.uk From mike at saxonica.com Sat Jan 12 09:24:00 2019 From: mike at saxonica.com (Michael Kay) Date: Sat, 12 Jan 2019 17:24:00 +0000 Subject: [xquery-talk] XQuery Function Annotations... and XSLT In-Reply-To: References: Message-ID: The XSLT approach to this is to use extension attributes, for example ... There's nothing that says such attributes are carried around as properties of the resulting function object, but there's also nothing that says they aren't. Michael Kay Saxonica > On 12 Jan 2019, at 14:24, Adam Retter wrote: > > Does anyone know if there is something similar in XSLT to XQuery 3.0's > Annotations? > > I am developing a set of XPath functions, which produce functions. > These produced functions can benefit from being treated in a certain > manner by a processor. > > I was thinking of using custom Annotations to label the produced > functions, so that a processor would have more information about how > they should be evaluated. Unfortunately I just realised that > Annotations are defined in the XQuery spec, not the lower XPath spec > (as I had assumed). > > Is there anything equivalent for functions (produced by functions) in XSLT? > > p.s. I will crosspost to the mulberry XSLT list as this seems relevant to both. > > Thanks Adam. > -- > Adam Retter > > skype: adam.retter > tweet: adamretter > http://www.adamretter.org.uk > _______________________________________________ > talk at x-query.com > http://x-query.com/mailman/listinfo/talk From adam.retter at googlemail.com Sat Jan 12 09:33:37 2019 From: adam.retter at googlemail.com (Adam Retter) Date: Sun, 13 Jan 2019 01:33:37 +0800 Subject: [xquery-talk] XQuery Function Annotations... and XSLT In-Reply-To: References: Message-ID: Ah very interesting, thanks Mike. That looks great for named functions. In XQuery I can also put an Annotation on an Inline Function Expr, is there any equivalent in XSLT? On Sun, 13 Jan 2019, 01:24 Michael Kay The XSLT approach to this is to use extension attributes, for example > > acme:use-lazy-evaluation="false">... > > There's nothing that says such attributes are carried around as properties > of the resulting function object, but there's also nothing that says they > aren't. > > Michael Kay > Saxonica > > > On 12 Jan 2019, at 14:24, Adam Retter > wrote: > > > > Does anyone know if there is something similar in XSLT to XQuery 3.0's > > Annotations? > > > > I am developing a set of XPath functions, which produce functions. > > These produced functions can benefit from being treated in a certain > > manner by a processor. > > > > I was thinking of using custom Annotations to label the produced > > functions, so that a processor would have more information about how > > they should be evaluated. Unfortunately I just realised that > > Annotations are defined in the XQuery spec, not the lower XPath spec > > (as I had assumed). > > > > Is there anything equivalent for functions (produced by functions) in > XSLT? > > > > p.s. I will crosspost to the mulberry XSLT list as this seems relevant > to both. > > > > Thanks Adam. > > -- > > Adam Retter > > > > skype: adam.retter > > tweet: adamretter > > http://www.adamretter.org.uk > > _______________________________________________ > > talk at x-query.com > > http://x-query.com/mailman/listinfo/talk > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at saxonica.com Sun Jan 13 02:41:00 2019 From: mike at saxonica.com (Michael Kay) Date: Sun, 13 Jan 2019 10:41:00 +0000 Subject: [xquery-talk] xs:error and AbstractTypes In-Reply-To: References: Message-ID: <9A660366-F767-4E97-AB4C-6C8631F5DE6A@saxonica.com> xs:error is defined in XSD 1.1 part 1: [Definition:]?? <>A special simple type definition, whose name is error in the XSD namespace, is also present in each ?XSD schema? . The XSD error type has no valid instances. It can be used in any place where other types are normally used; in particular, it can be used in conditional type assignment to cause elements which satisfy certain conditions to be invalid. In ?3.16.7.3 it is defined as a union type with no member types. I think that this call should fail on the grounds that () is not a valid instance of xs:error. What's happening is apparently that when xs:error is used as a SequenceType, it is given a required cardinality of 0, and the type matching, when it sees a required cardinality of 0, allows an empty sequence to appear. I think the correct handling would be to have a required cardinality of 1. Raised at https://saxonica.plan.io/issues/4091 Michael Kay Saxonica > On 12 Jan 2019, at 09:22, Adam Retter wrote: > > Whilst looking for a type which is declarable in XQuery but that > cannot be constructed, I wrote a strange query, well to me anyway, > which evaluates on Saxon 9.8.0.12 PE, and returns . > > declare function local:test1($x as xs:error) { > > }; > local:test1(()) > > You can also modify the query so the parameter has one-or-mode > cardinality e.g. "$x as xs:error+", and it will still evaluate with an > empty sequence as the argument. I believe that this is because > xs:error is always an empty type. > > BaseX and eXist-db both refuse to evaluate the query, saying that the > type xs:error is unknown. > > Am I right in thinking that Saxon evaluates this because it supports > [Schema 1.1 Part 2], whereas eXist-db and BaseX do not? > > Also if anyone has any bright ideas, about a type that I could > explicitly declare for a function argument, but that CANNOT be > constructed within XQuery, I would be interested to know. I think > Union types are out as I want to support all processors (i.e. not > require Schema support). > > So far I haven't seen anything... > > -- > Adam Retter > > skype: adam.retter > tweet: adamretter > http://www.adamretter.org.uk > _______________________________________________ > talk at x-query.com > http://x-query.com/mailman/listinfo/talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.retter at googlemail.com Sun Jan 13 04:01:00 2019 From: adam.retter at googlemail.com (Adam Retter) Date: Sun, 13 Jan 2019 20:01:00 +0800 Subject: [xquery-talk] xs:error and AbstractTypes In-Reply-To: <9A660366-F767-4E97-AB4C-6C8631F5DE6A@saxonica.com> References: <9A660366-F767-4E97-AB4C-6C8631F5DE6A@saxonica.com> Message-ID: Thanks Mike :-) On Sun, 13 Jan 2019 at 18:41, Michael Kay wrote: > > xs:error is defined in XSD 1.1 part 1: > > [Definition:] A special simple type definition, whose name is error in the XSD namespace, is also present in each ?XSD schema?. The XSD error type has no valid instances. It can be used in any place where other types are normally used; in particular, it can be used in conditional type assignment to cause elements which satisfy certain conditions to be invalid. > > In ?3.16.7.3 it is defined as a union type with no member types. > > I think that this call should fail on the grounds that () is not a valid instance of xs:error. > > What's happening is apparently that when xs:error is used as a SequenceType, it is given a required cardinality of 0, and the type matching, when it sees a required cardinality of 0, allows an empty sequence to appear. I think the correct handling would be to have a required cardinality of 1. > > Raised at https://saxonica.plan.io/issues/4091 > > Michael Kay > Saxonica > > On 12 Jan 2019, at 09:22, Adam Retter wrote: > > Whilst looking for a type which is declarable in XQuery but that > cannot be constructed, I wrote a strange query, well to me anyway, > which evaluates on Saxon 9.8.0.12 PE, and returns . > > declare function local:test1($x as xs:error) { > > }; > local:test1(()) > > You can also modify the query so the parameter has one-or-mode > cardinality e.g. "$x as xs:error+", and it will still evaluate with an > empty sequence as the argument. I believe that this is because > xs:error is always an empty type. > > BaseX and eXist-db both refuse to evaluate the query, saying that the > type xs:error is unknown. > > Am I right in thinking that Saxon evaluates this because it supports > [Schema 1.1 Part 2], whereas eXist-db and BaseX do not? > > Also if anyone has any bright ideas, about a type that I could > explicitly declare for a function argument, but that CANNOT be > constructed within XQuery, I would be interested to know. I think > Union types are out as I want to support all processors (i.e. not > require Schema support). > > So far I haven't seen anything... > > -- > Adam Retter > > skype: adam.retter > tweet: adamretter > http://www.adamretter.org.uk > _______________________________________________ > talk at x-query.com > http://x-query.com/mailman/listinfo/talk > > -- Adam Retter skype: adam.retter tweet: adamretter http://www.adamretter.org.uk