Re: [xsl] Member function?

Subject: Re: [xsl] Member function?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 2 Aug 2022 15:14:46 -0000
Even in XPath 1.0   I would use:

contains('|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|', concat('|',
substring-before($d, ' '),  '|')

On Tue, Aug 2, 2022 at 7:56 AM Dave Pawson dave.pawson@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> On Tue, 2 Aug 2022 at 15:50, Martin Honnen martin.honnen@xxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> > Given that you say XPath 2 or 3 I assume XSLT 2 or 3 so I would prefer a
> > variable or parameter e.g.
> >
> >
> > <xsl:variable name="sort-index">
> >
> >      <d:entry key="Jan" index="0"/>
> >      <d:entry key="Feb" index="1"/>
> >      <d:entry key="Mar" index="2"/>
> >      <d:entry key="Apr" index="3"/>
> >      <d:entry key="May" index="4"/>
> >      <d:entry key="Jun" index="5"/>
> >      <d:entry key="Jul" index="6"/>
> >      <d:entry key="Aug" index="7"/>
> >      <d:entry key="Sep" index="8"/>
> >      <d:entry key="Oct" index="9"/>
> >      <d:entry key="Nov" index="10"/>
> >      <d:entry key="Dec" index="11"/>
> >
> > </xsl:variable>
>
> Simpler yes. Tks.
>
> >
> > and then a key
> >
> > <xsl:key name="sort-index" match="d:entry" use="@key"/>
> >
> >
> > and then a check on
> >
> >     key('sort-index', tokenize(d, ' '), $sort-index)
> >
> > or
> >
> >    key('sort-index', tokenize(d, '')[1], $sort-index)
>
> So a non-match would result in a null key value?
>
>
> Thanks Martin.
>
>
> regards
>
>
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> 
>
>

-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write
all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread