How about
preceding-sibling::processing-instruction() except
preceding-sibling::node()/preceding-sibling::processing-instruction()
?
Presumably this should get any PI that is immediately behind the context node,
but none that are not. (Untested.)
Cheers, Wendell
From: Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, May 8, 2023 11:31 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Is the first preceding-sibling a processing-instruction?
I interpreted the initial requirement as "If the first preceding sibling that
is not an empty text() node is a processing instruction, get that".
But the markup as shown as the starting point only has elements, PIs, and text
nodes, so for that content a simple
preceding-sibling::processing-instruction()[1] would give the right answer,
assuming there is always a PI before each element.
Cheers,
E.
_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com/>
LinkedIn<https://www.linkedin.com/company/servicenow> |
Twitter<https://twitter.com/servicenow> |
YouTube<https://www.youtube.com/user/servicenowinc> |
Facebook<https://www.facebook.com/servicenow>
From: Graydon graydon@xxxxxxxxx<mailto:graydon@xxxxxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>>
Date: Monday, May 8, 2023 at 10:02 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
<xsl-list@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx>>
Subject: Re: Is the first preceding-sibling a processing-instruction?
[External Email]
On Mon, May 08, 2023 at 01:37:45PM -0000, Michael Kay
mike@xxxxxxxxxxxx<mailto:mike@xxxxxxxxxxxx> scripsit:
> But you could do
>
>
preceding-sibling::node()[not(self::text())][1][self::processing-instruction(
)]
I would use
preceding-sibling::processing-instruction()[1]
And I think it means "of my preceding siblings nodes which have node
type processing instruction, I want the one closest to me".
Have I got that wrong? Or is it only wanted if there's no intervening
node that's not a white space only text node?
--
Graydon Saunders | graydonish@xxxxxxxxx<mailto:graydonish@xxxxxxxxx>
^fs oferiode, pisses swa mfg.
-- Deor ("That passed, so may this.")
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/3302254> (by
email<>)
|