Subject: Re: [xsl] Does it make sense to collect elements with a certain value then assert that the elements I've collected have that certain value? From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 31 Jul 2024 14:47:13 -0000 |
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Does it make sense to collect, Roger L Costello cos | Thread | Re: [xsl] Does it make sense to col, Michael Mueller-Hill |
[xsl] Does it make sense to collect, Roger L Costello cos | Date | Re: [xsl] Does it make sense to col, Michael Mueller-Hill |
Month |