On Wed, Aug 17, 2022 at 12:22:15PM -0000, Roger L Costello costello@xxxxxxxxx scripsit:
> I am using the path() function and it is generating paths like this:
>
> /Q{}AeroPublication[1]/Q{}airports[1]/Q{}airport[1]/Q{}icaoCode[1]
>
> Now I want to convert that full path into an abbreviated path, consisting of just the last 3 names:
>
> airports/airport/icaoCode
>
> I can write a bunch of XSLT code that does this conversion. But is there an XPath expression which does it?
(($path => tokenize('/'))[position() gt last() - 3] ! replace(.,'\[\p{Nd}+\]','') ! replace(.,'Q\{\}','')) => string-join('/')
An example of an XPath expression which is best stuffed in a function.
--
Graydon Saunders | graydonish@xxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor ("That passed, so may this.")
|