Re: [xsl] XPath equivalent to xsl:apply-templates?

Subject: Re: [xsl] XPath equivalent to xsl:apply-templates?
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 12 Jun 2022 21:03:53 -0000
On Sun, Jun 12, 2022 at 08:22:25PM -0000, Roger L Costello costello@xxxxxxxxx scripsit:
[snip]
> The tricky element is mapping each military airport to commercial airports, i.e., for each military airport create an <airport> element in the commercial instance document:
> 
> <airports>
>     for $i in $ARPT.XML/ARPT/row return the result of applying the template rule for <airport> for $i
>     <airport>
>         <identifier>$ARPT_row/ICAO</identifier>
>         ....
>     </airport>
> </airports>
> 
> Obviously, "the result of applying the template rule for <airport> for $i" is not XPath; it's just English.
> 
> So my question is: what would be the XPath equivalent of "the result of applying the template rule for <airport> for $i"?

There isn't one.

While XPath 3.1 is formally a turing-complete language, there are a
whole bunch of things it doesn't makes sense to do with XPath.  Applying
templates might be three of them.

For inescapable reasons, the solution has to be at least as complicated
as the problem.

This sounds like a trivial problem to solve with templates; there's no
reason you can't generate the templates.  There's no reason you couldn't
generate a map of functions, either, especially if there's a relatively
small number of cases for the processing.

-- 
Graydon Saunders  | graydonish@xxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor  ("That passed, so may this.")

Current Thread