Re: [xsl] Nicer way to change context-node than xsl:for-each ?

Subject: Re: [xsl] Nicer way to change context-node than xsl:for-each ?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sat, 5 Dec 2009 09:22:21 -0800
>> The use of an <xsl:function> to produce content is simple:
>> B <xsl:sequence select="my:foo(bar)"/>
> sure. but can something like following, be simulated with XPath 2
> function calls?
> <xsl:variable name="x">
> B <xsl:call-template ... />
> </xsl:variable>
> I think, we cannot.

   <xsl:variable name="x" select="my:foo(bar)" as="appropriate type"/>


   <xsl:variable name="x">
        <xsl:sequence select="my:foo(bar)"/>

The first of the two above is shorter and probably stylistically better.

>> Didn't you know that <xsl:apply-templates> can be used in pull-style
>> processing? Modes and uniquely namespaced nodes should light a bulb :)
> I am not sure, if that's entirely correct. Working on
> xsl:apply-templates with modes looks to me semi pull style, and not a
> pull style in entirety!

It is not "semi pull style". Its pull style when only one template has
that mode or matches a node from a uniquely defined namespace (used
only for the purpose of identifying its matching template).

>> Anyone (who hasn't already come to this conclusion) can find all facts
>> and conclude that the following is not needed:
> That gives me kind of a laugh :)

Sure, like when beating a dead horse.

> My suggestions, may not be entirely correct from design point of view.
> But saying, that I am entirely wrong, amuses me (my proposal is still
> a XSLT 2.x feature design discussion!) :)

Hey, where did I say that you were "entirely wrong" or just "wrong" ?

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
You've achieved success in your field when you don't know whether what
you're doing is work or play
I enjoy the massacre of ads. This sentence will slaughter ads without
a messy bloodbath.

Current Thread