xsl-list
[Top] [All Lists]

Re: [xsl] Casting single-item sequences to atomic values

2014-04-08 12:32:14

On 8 Apr 2014, at 14:42, Wendell Piez <wapiez(_at_)wendellpiez(_dot_)com> 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
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>