Re: [xsl] How to create xsl:key that has a composite value in its "use" attribute?

Subject: Re: [xsl] How to create xsl:key that has a composite value in its "use" attribute?
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 15 Mar 2025 19:49:20 -0000
Dimitre,

Where you have

  key('kBoundaryForNav', key('kNavForAirport', ARPT_IDENT)/(NAV_IDENT ||
'+' || NAV_CTRY || '+' || NAV_TYPE))/BDRY_IDENT

could not this be

  key('kNavForAirport', ARPT_IDENT) / key('kBoundaryForNav', (NAV_IDENT ||
'+' || NAV_CTRY || '+' || NAV_TYPE) ) / BDRY_IDENT

which is perhaps a little more intelligible? (Apologies if I am wrong in
detail, I haven't tested.)

Keeping in mind that calls on key() can be strung together since XSLT 1.0
(IIRC). In other words, this might be worth a try in Saxon 6.5 with the
concat() adjustment as you suggest.

Cheers, Wendell


On Sat, Mar 15, 2025 at 1:51b/PM Dimitre Novatchev dnovatchev@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> I would use even this (can be XSLT 2.0 if || is done using concat() ):
>
> <xsl:stylesheet version="3.0" xmlns:xsl="
> http://www.w3.org/1999/XSL/Transform";>
> <xsl:output omit-xml-declaration="yes" indent="yes"/>
> <xsl:key name="kNavForAirport" match="ANAV/row" use="ARPT_IDENT"/>
> <xsl:key name="kBoundaryForNav" match="BDRY/row" use="NAV_IDENT || '+' ||
> NAV_CTRY || '+' || NAV_TYPE"/>
>
>   <xsl:template match="/*">
>     <New-Document>
>       <airports>
>          <xsl:apply-templates select="ARPT/ARPT/row"/>
>       </airports>
>     </New-Document>
>   </xsl:template>
>
>   <xsl:template match="ARPT/ARPT/row">
>     <airport>
>       <ARPT_IDENT><xsl:value-of select="ARPT_IDENT"/></ARPT_IDENT>
>       <fir>
>        <xsl:copy-of select="key('kBoundaryForNav', key('kNavForAirport',
> ARPT_IDENT)/(NAV_IDENT || '+' || NAV_CTRY || '+' ||
NAV_TYPE))/BDRY_IDENT"/>
>       </fir>
>     </airport>
>   </xsl:template>
> </xsl:stylesheet>
>
> On Sat, Mar 15, 2025 at 9:27b/AM Martin Honnen martin.honnen@xxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>>
>> On 15/03/2025 17:19, Roger L Costello costello@xxxxxxxxx wrote:
>> > <xsl:template match="ARPT/ARPT/row">
>> >
>> >      <result>
>> >
>> >          <xsl:for-each select="key('ARPT-to-ANAV', ARPT_IDENT)">
>> >
>> >              <xsl:sequence
>> select="key('ANAV-to-BDRY',(NAV_IDENT,NAV_CTRY,NAV_TYPE))[TYPE eq
>> '08']/BDRY_IDENT"/>
>> >
>> >        </xsl:for-each>
>> >
>> >      </result>
>> >
>> > </xsl:template>
>>
>>
>> That could be written as
>>
>> <xsl:template match="ARPT/ARPT/row">
>>
>>      <result>
>>
>>              <xsl:sequence select="key('ARPT-to-ANAV', ARPT_IDENT) !
>> key('ANAV-to-BDRY',(NAV_IDENT,NAV_CTRY,NAV_TYPE))[TYPE eq
>> '08']/BDRY_IDENT"/>
>>
>>      </result>
>>
>> </xsl:template>
>>
>> I would think.
>>
>>
>>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/174322> (by
> email <>)
>


--
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...

Current Thread