[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
Russ,
At 02:02 PM 4/16/2009, you wrote: 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. The fact that you get all your GenTable elements when your count is >= 0, but none of them when your count >= 1, indicates that your count is 0 for all of them. In turn, this suggests your conditionals are wrong in some systematic way. I'll rephrase your XPath in a way that is more or less the same, but a bit more legible. (I say "more or less" since one thing I'm doing is removing the normalize-space() munging; if you need it you can put it back but it complicates things for purposes of explanation. But none of my other changes are meaningful.) //GenTable[count(child::entry [child::Emphasis[@type='bold'][.='Address Offset'] or child::Emphasis[@type='bold'][.='Physical Address'] or child::Emphasis[@type='bold'][.='Instance'] or child::Emphasis[@type='bold'][.='Description'] or child::Emphasis[@type='bold'][.='Type'] ] ) >= 4] So ... it's collecting all GenTable elements that have at least four entry children meeting the following criterion: they must all have at least one Emphasis child of @type='bold' and with a value (whitespace-normalized, as you had it) of "Address Offset", "Physical Address", "Instance", "Description" or "Type". But evidently you have none, and indeed you haven't got any GenTable elements with even one entry child meeting this test. Just guessing wildly (sorry, I didn't save your data sample), I expect that the relations among the elements isn't right. Do GenTable elements have entry children (a table with entries but not rows)? Do entry elements have Emphasis children? Maybe instead of 'child::entry' you want 'descendant::entry' (shorthand: './/entry') or '*/entry' (short for 'child::*/child::entry') or 'row/entry'. Additionally, there's (at least) one other thing you can do to make the path more concise, even as it stands: //GenTable[count(entry [Emphasis[@type='bold'] [(.='Address Offset') or (.='Physical Address') or (.='Instance') or (.='Description') or (.='Type') ] ) >= 4] ... and, were you able to use XPath 2.0 (and putting the normalize-space() back): //GenTable[count(entry [Emphasis[@type='bold'] [normalize-space(.)=('Address Offset', 'Physical Address', 'Instance', 'Description', 'Type') ] ) >= 4] Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|