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: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 31 Jul 2024 15:09:01 -0000 |
> 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: No, unless you are testing the correctness of the XPath processor itself. Such an assert could though be useful if you are passing this as a parameter to someone else's code and this person doesn't know you at all, or enough to trust you - a case that often happens in 3rd-party library modules. Thanks, Dimitre On Wed, Jul 31, 2024 at 6:58b/AM Roger L Costello costello@xxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 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 "/>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Does it make sense to col, Michael Mueller-Hill | Thread | Re: [xsl] Does it make sense to col, Michael Kay michaelk |
Re: [xsl] Does it make sense to col, Michael Mueller-Hill | Date | Re: [xsl] Does it make sense to col, Michael Kay michaelk |
Month |