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

Re: Filtering on a tokenized list

Subject: Re: Filtering on a tokenized list
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 23 Feb 2017 13:01:09 -0000
Re:  Filtering on a tokenized list
On 23.02.2017 13:49, Rick Quatro rick@xxxxxxxxxxxxxx wrote:

I have an attribute value that I want to convert to a sequence of decimals:

@colwidth="0.439in 1.845in"

I am using tokenize to drop the measurement units before I convert each
member to decimal:


This works, except I get a empty string as the last item in the list. I saw
in Michael's book that I can filter out the empty member with a predicate:


I can't quite understand how the predicate [.] works. Is it like saying
"non-empty strings"? Would it be equivalent to


tokenize returns a sequence of strings and then then the predicate [.] applied to the sequence of strings checks the boolean value of each string and empty strings, when converted to a boolean, are false while non-empty strings are true.

If you check https://www.w3.org/TR/xpath-30/#id-filter-expression then it says

The predicate truth value is derived by applying the following rules, in order:

If the value of the predicate expression is a singleton atomic value of a numeric type or derived from a numeric type, the predicate truth value is true if the value of the predicate expression is equal (by the eq operator) to the context position, and is false otherwise. [Definition: A predicate whose predicate expression returns a numeric type is called a numeric predicate.]

Otherwise, the predicate truth value is the effective boolean value of the predicate expression.

and https://www.w3.org/TR/xpath-30/#id-ebv says

If its operand is a singleton value of type xs:string, xs:anyURI, xs:untypedAtomic, or a type derived from one of these, fn:boolean returns false if the operand value has zero length; otherwise it returns true.

Current Thread


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.
First Name
Last Name
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.