On 25/11/2019 19:39, Costello, Roger L. costello(_at_)mitre(_dot_)org wrote:
[snip]
That is, my XPath query does not account for the requirement that
the long series of paragraph elements be uninterrupted. How to write
an XPath 2.0 query for this?
preceding-sibling() count *any* preceding sibling, not contiguous
preceding siblings
I think you need to locate the closest preceding element that is *not*
empty of text, and the count the elements between that and your context
element, eg:
count(preceding-sibling::p[.!=' '][1]
/following-sibling::p[.=' '])
That should return 24 for your first example and 9 for the second.
P
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--