|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Getting the data type of an element
> > 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








