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

Re: XPath expression which checks that a string is be

Subject: Re: XPath expression which checks that a string is between 1 and 10 characters in length?
From: "Dan Sullivan dsullivan@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Jul 2016 15:04:38 -0000
Re:  XPath expression which checks that a string is  be
What is the purpose of making befficientb source code?

I donbt think it is a good idea to assume that some kind of source code
befficiencyb will result in execution or other efficiency.

I did a really trivial test and found no execution time difference between

<result><xsl:value-of select="count(data/w[boolean(string-length(.)[. > 0 and
. &lt; 11])])"/></result>


<result><xsl:value-of select="count(data/w[string-length(.) > 0 and
string-length(.) &lt; 10])"/></result>

The binefficientb code here

[string-length(.) > 0 and string-length(.) &lt; 10]

has the property that it is completely obvious what it is testing...


On 7/26/16, 7:51 AM, "Costello, Roger L. costello@xxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>Hi Folks,
>I need an XPath expression which returns true if the string in <A> is between
1 and 10 characters in length, and false otherwise.
>For example, the XPath expression should return true on this XML:
>	<A>hi</A>
>Here's an inefficient XPath expression:
>(string-length(.) gt 0) and (string-length(.) le 10)
>It's inefficient because it computes the string length twice.
>Is there a more efficient XPath expression to solve this problem?

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.