|
Subject: Re: [xsl] XPath expression which converts the output of path() into an abbreviated path? From: "Alan Painter alan.painter@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 17 Aug 2022 12:38:12 -0000 |
Suggesting similar:
For variable $s with string text ...
tokenize($s, '/')[position() = (last()-2 to last())]!replace(.,
'.*\}(.*)\[.*', '$1')=>string-join('/')
On Wed, Aug 17, 2022 at 2:34 PM Martin Honnen martin.honnen@xxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Am 17.08.2022 um 14:22 schrieb Roger L Costello costello@xxxxxxxxx:
> > Hi Folks,
> >
> > 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?
> >
>
> Assuming we process only the result of path() it should be possible with
> tokenize and replace and string-join e.g.
>
>
>
> string-join((('/Q{}AeroPublication[1]/Q{}airports[1]/Q{}airport[1]/Q{}icaoCode[1]'
> => tokenize('/')) ! replace(., '^Q\{[^{]*\}|\[[0-9]+\]$',
> ''))[position() gt last() - 3], '/')
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] XPath expression which co, Martin Honnen martin | Thread | Re: [xsl] XPath expression which co, Martin Honnen martin |
| Re: [xsl] XPath expression which co, Martin Honnen martin | Date | Re: [xsl] XPath expression which co, Graydon graydon@xxxx |
| Month |