xsl-list
[Top] [All Lists]

Re: [xsl] Need an XPath 2.0 expression that identifies a long block of uninterrupted non-blocking space characters in an XHTML document

2019-10-15 01:02:59
On Mon, Oct 14, 2019 at 10:38 PM Costello, Roger L. 
costello(_at_)mitre(_dot_)org <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

I came up with this XPath expression:

//p[o:p eq '&#160;'][count(following-sibling::*[position() le 10][name()
eq 'p'][o:p eq '&#160;']) ge 10][1]

It says, "Give me the first <p> element containing a non-blocking space
character such that there are at least 10 <p> elements that immediately
follow it, each containing a non-blocking space character." At least,
that's what I think it says. Note: 10 is an arbitrary number.

1. Do you see any problems with the XPath expression?


I think that, your XPath expression should be following,

//p[o:p eq '&#160;'][count(following-sibling::*[name() eq 'p'][o:p eq
'&#160;']) ge 10][1]

(not tested)

The predicate [position() le 10] occurring for the first time in your
expression, doesn't seem to be needed.


2. Is there a better XPath expression?


I could visually inspect / review Mike Kay's expression, and can say that
its correct.



-- 
Regards,
Mukul Gandhi
--~----------------------------------------------------------------
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
--~--
<Prev in Thread] Current Thread [Next in Thread>