Re: [xsl] Is the first preceding-sibling a processing-instruction?

Subject: Re: [xsl] Is the first preceding-sibling a processing-instruction?
From: "Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 8 May 2023 15:30:08 -0000
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 <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Monday, May 8, 2023 at 10:02 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] Is the first preceding-sibling a processing-instruction?
[External Email]

On Mon, May 08, 2023 at 01:37:45PM -0000, Michael Kay 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
^fs oferiode, pisses swa mfg.
-- Deor ("That passed, so may this.")

Current Thread