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

RE: Getting the data type of an element

Subject: RE: Getting the data type of an element
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 13 Jan 2004 17:17:39 -0000
attribute data type
> 
> How can a sequence of anything be an instance of xs:boolean Mike?

In the XPath data model true() is both a boolean and a sequence
containing a single boolean. There is no distinction between an item and
a sequence of length one containing that item.

This reflects the way list-valued attributes work in XML Schema (and in
DTDs): you wouldn't expect the attribute value "red" to behave
differently when you change the type from NMTOKEN to NMTOKENS. 
> 
> 
> <xsl:if test=". instance of xs:boolean">
> 
> I'd interpret that as 'the context node value is a boolean'. 
> What's the difference between . and data(.) please?

data(.) forces atomization (i.e. extracting the value of a node). If X
is an element then it cannot be a boolean, but its content can be a
boolean. Many operators such as "+" and "=" force atomization of their
operands, but some, like count() and "instance of", do not. For example
with an NMTOKENS attribute a="red green blue", count(@a) is 1 but
count(data(@a)) is 3.
> 
> Are  you are assuming the context is a sequence of one item?
>  
There is a thing called the "context item" which is either a single item
(=a sequence of one item) or is undefined (loosely, null).

Michael Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.