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

RE: Big long xpath, almost there, but not quite

Subject: RE: Big long xpath, almost there, but not quite
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 16 Apr 2009 19:20:59 +0100
RE:  Big long xpath
Your expression is

count (A or B or C or D or E) >= 4

But (A or B or C or D or E) is a boolean, and the count() of a single
boolean value is always 1.

Try count((boolean(A), boolean(B), boolean(C), boolean(D), boolean(E))[.])
>= 4

The unusual predicate [.] selects those booleans in the sequence that are
true.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: russurquhart1@xxxxxxxxxxx [mailto:russurquhart1@xxxxxxxxxxx] 
> Sent: 16 April 2009 19:03
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Big long xpath, almost there, but not quite
> 
> 
> 
> I want to thank everybody for their help on this. Michael 
> Kay, thaks for your help very much. I entered the following 
> Xpath. It is getting there, but it still is not quite right.
> 
> //GenTable[count(entry[Emphasis[normalize-space(.) = 'Address 
> Offset' and @type='bold'] or 
> Emphasis[normalize-space(.)='Physical Address' and 
> @type='bold'] or Emphasis[normalize-space(.)='Instance' and 
> @type='bold'] or Emphasis[normalize-space(.)='Description' 
> and @type='bold'] or Emphasis[normalize-space(.)='Type' and 
> @type='bold'] ]) >= 4]
> 
> When i use this, as i would like at least 4 entry element 
> that match the conditions above, hopefully 5, i would think 
> this should do the trick and return the GenTable elements 
> that contain them.
> 
> When i run it, however, i get no GenTable elements. When i 
> remove the count() function, i get no GenTable elements. When 
> i change the 4 9the minimum match value, to something smaller 
> like 1) i get no GenTable elements. When i change the number 
> 4 to 0, i get ALL the GenTable elements.
> 
> I would have thought that removing the count() function would 
> have given me all the GenTable elements containing those 
> entry elements.
> 
> Could someone explain a little about this? The reasoning 
> seems sound, i just don't know why it is doing what it is!
> 
> thanks again,
> 
> 
> Russ

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.