[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to write (existential) predicates with maps/Wh

Subject: Re: How to write (existential) predicates with maps/Why is there no effective boolean value for a map?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Feb 2019 14:40:18 -0000
Re:  How to write (existential) predicates with maps/Wh
I'm having trouble understanding/reproducing this. Can you supply a complete
repro? (I.e., the source data that results in this error)

I've checked the message, and it's actually inaccurate: the offending item
might be a function/array/map rather than an atomic value.

Michael Kay
Saxonica

> On 11 Feb 2019, at 12:09, Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> When using XPath 3.1 (e.g. in XSLT 3) on maps I have found that I have to
change my coding habit a bit when writing predicates that want to check the
existence of some nested map, while I hoped to be able to write e.g.
>
>  ?locations?*[?types?*[?name = 'foo']]
>
> to select all (map) members of the "locations" array that have a "types"
array with at least one (map) member having a property "name" with value "foo"
I get an error
>
> Effective boolean value is not defined for sequence starting with an atomic
value other than a boolean, number, or string
>
>
> So in contrast to my experience with writing predicates on XML it seems for
maps I have to explicitly use the "exists" function e.g.
>
>  ?locations?*[exists(?types?*[?name = 'foo'])]
>
> or a "some .. in" expression
>
>  ?locations?*[some $m in ?types?* satisfies $m?name = 'foo']
>
>
> Is there any more compact way to write such a check?
>
> What is the reason that the effective boolean value was not extended to give
true for a sequence with a map?

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.