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

Re: Casting single-item sequences to atomic values

Subject: Re: Casting single-item sequences to atomic values
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 8 Apr 2014 18:31:58 +0100
Re:  Casting single-item sequences to atomic values
On 8 Apr 2014, at 14:42, Wendell Piez <wapiez@xxxxxxxxxxxxxxx> wrote:

> Christian,
>
> This is easy to find in the spec ... if you look at the right spec. :-)
>
> http://www.w3.org/TR/xpath-datamodel/#sequences
>
> Cheers, Wendell
>


It might also be worth reminding people WHY a singleton and a sequence of
length one are the same thing in XDM.

Consider

<book>
  <author>John</author>
</book>

Is child::author a single element, or a sequence of elements with length one?
You can't tell without a schema. Treating both the same way is part of the
"semi-structuredness" of XPath as an XML processing language. Contrast data
binding tools, which rely on a schema to decide whether author is a
single-valued or list-valued property, and cause your programs to break if the
schema changes.

Michael Kay
Saxonica

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.