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 19:18:50 -0000
Hi Roger,

>  [As I recall Dimitre is working to show how every construct in XSLT can
be represented in XPath. Okay, Dimitre, what's the XPath equivalent of
xsl:apply-templates?]

I don't remember ever making such a statement. ?!?

And in my work it has never been raised as a problem to represent the
generic <xsl:apply-templates> in pure Xpath.

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?

Once again: while it may be possible in XPath to implement function
dispatch based on arguments' type and context, I don't see why someone
would need to do this. Suppose we could write an XSLT processor in pure
XPath, then the result will still be essentially XSLT with its fundamental
principles and ideas.

Thanks,
Dimitre

On Sun, Jun 12, 2022 at 11:06 AM Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Folks,
>
> I have inserted XPath code into an XML document, e.g.,
>
>    <identifier>$ARPT_row/ICAO</identifier>
>
> I wrote some code that extracts the XPath code and generates an XSLT
> template:
>
>     <xsl:template match="airports/airport/identifier">
>         <xsl:param name="ARPT_row" tunnel="yes"/>
>         <identifier>
>             <xsl:value-of select="$ARPT_row/ICAO"/>
>         </identifier>
>     </xsl:template>
>
> In some cases, I want to generate an XSLT template that has an
> xsl:apply-templates, e.g.,
>
>     <xsl:template match="airports">
>         <xsl:param name="ARPT_row" tunnel="yes"/>
>         <airports>
>             <xsl:for-each select="$ARPT.XML/ARPT/row">
>                 <xsl:apply-templates select="current()/*">
>                     <xsl:with-param name="ARPT_row" tunnel="yes"
> select="."/>
>                 </xsl:apply-templates>
>             </xsl:for-each>
>         </airports>
>     </xsl:template>
>
> What XPath code to put in the XML document <airports> element:
>
>    <airports>???</airports>
>
> The xsl:for-each can be replaced with the XPath "for" statement:
>
>    <airports>for $i in $ARPT.XML/ARPT/row return ???</airports>
>
> Do you have suggestions for an XPath that results in generating
> xsl:apply-templates?
>
> Is there an XPath equivalent to xsl:apply-templates? (Not sure if that
> question makes sense)
>
> [As I recall Dimitre is working to show how every construct in XSLT can be
> represented in XPath. Okay, Dimitre, what's the XPath equivalent of
> xsl:apply-templates?]
>
> /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