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: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 15 Mar 2025 17:50:55 -0000
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.

Current Thread