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

Subject: Re: [xsl] XPath equivalent to xsl:apply-templates?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 12 Jun 2022 20:41:17 -0000
Hi Roger,

The problem is still not well defined, ambiguous (maybe because the input
and output vocabularies have similar or even overlapping terminology), and
confusing.

Will something like a function:

       my:applyTemplates($item-set-expression, $parameters-array)

be useful?


Thanks,
Dimitre

On Sun, Jun 12, 2022 at 1:22 PM Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Dimitre,
>
> > Perhaps, if we have a more understandable and simple example,
> > we could understand what it exactly is that you need, and why
> > you need it in the first place?
>
> Okay, a bit more context to my question.
>
> I am mapping one XML vocabulary to another (a military air navigation
> standard to the commercial air navigation standard).
>
> I have a sample XML instance document of the commercial air navigation
> standard:
>
> <airports>
>     <airport>
>         <identifier>____</identifier>
>         ....
>     </airport>
> </airports>
>
> I want to:
>
> (1) Show the mapping in a simple way.
> (2) Create a tool which does the mapping; i.e., use the military air nav
> data to populate an XML instance document that conforms to the commercial
> air nav.
>
> I have found a nice way to show the mapping: In the commercial air nav
> instance document, embed XPath expressions that shows the mapping, e.g.,
>
> <airports>
>     <airport>
>         <identifier>$ARPT_row/ICAO</identifier>
>         ....
>     </airport>
> </airports>
>
> For the second part (create a tool that does the mapping) I wrote some
> code that extracts the XPath expressions within each element and generates
> an XSLT template for each element, e.g.,
>
>     <xsl:template match="airports/airport/identifier">
>         <xsl:param name="ARPT_row" tunnel="yes"/>
>         <identifier>
>             <xsl:value-of select="$ARPT_row/ICAO"/>
>         </identifier>
>     </xsl:template>
>
> 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"?
>
> > Suppose we could write an XSLT processor in pure XPath,
> > then the result will still be essentially XSLT with its
> > fundamental principles and ideas.
>
> Ah! I guess that is what I was remembering. Sorry for the error.
>
> /Roger
>
> 
>
>

-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write
all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread