On 31/07/2024 15:58, Roger L Costello costello@xxxxxxxxx wrote:
> Hi Folks,
>
> $airport-id holds the identifier of an airport.
>
> I use $airport-id to collect <row> elements in $airports-nav-records with a
matching ARPT_IDENT:
>
> <xsl:variable name="nav-records-for-this-airport"
> select="$airports-nav-records//row[ARPT_IDENT eq
$airport-id]"
> as="element(row)*"/>
>
> Does it make sense to verify that every <row> element in
$nav-records-for-this-airport has an ARPT_IDENT that matches $airport-id? Is
there a benefit to this assert:
>
> <xsl:assert test="every $i in $nav-records-for-this-airport satisfies
$i/ARPT_IDENT eq $airport-id "/>
>
> To my way of thinking, there is no benefit. I collected <row> elements with
a matching ARPT_IDENT, then the assert tests that the collected <row> elements
have a matching ARPT_IDENT. The assert seems
pointless/redundant/useless/wasteful. Am I missing something?
>
> Here's the assert in context:
>
> <xsl:for-each select="$airports/*/row">
> <xsl:variable name="airport-id"
> select="ARPT_IDENT"
> as="xs:string"/>
> <xsl:variable name="nav-records-for-this-airport"
>
select="$airports-nav-records//row[ARPT_IDENT eq $airport-id]"
> as="element(row)*"/>
> <xsl:assert test="every $i in $nav-records-for-this-airport
satisfies $i/ARPT_IDENT eq $airport-id "/>
It seems indeed pointless with the code as shown to repeat the condition
in an assert.
As for the rest of the code, consider to use a key for the lookup by
ARPT_IDENT.
|