xsl-list
[Top] [All Lists]

Re: [xsl] Dynamic dispatch of functions/templates (was matching text() )

2010-12-23 10:31:30
But suppose I could do the same thing with functions or named templates but
still let matching work ?
Then I could do something like

            <xsl:call-template name="????">
                        <xsl:value-of  select="string()"/>
          </xsl:call-template>



Something equivalent to this can be done and was done 10 years ago and
incorporated as the foundation of FXSL.

You can read about FXSL here:

http://conferences.idealliance.org/extreme/html/2006/Novatchev01/EML2006Novatchev01.html


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
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.



On Thu, Dec 23, 2010 at 6:37 AM, David Lee <dlee(_at_)calldei(_dot_)com> wrote:
Still thinking how to change

            <xsl:apply-templates select="text()"/>
            …

<xsl:template match="some_xpath/text()" >
..


Into something where the text is concatenated in the face of PI's or
comments.

I need (or think I do ) something that is dynamic dispatch.
That is, the code that generates
                        <xsl:apply-templates select="text()"/>

Doesn’t (easily) know which rule to invoke so I'm using the template match
form.

But suppose I could do the same thing with functions or named templates but
still let matching work ?
Then I could do something like

            <xsl:call-template name="????">
                        <xsl:value-of  select="string()"/>
          </xsl:call-template>


I think I'm answering my own question … I need to generate unique names …
but maybe there's a way to mix these 2 modes ?  Call a fixed constant
template that has varients based on a match string ?
What I want is some rule that triggers on

<xsl:template match="some_xpath/string()" >

But that doesn’t work, nor does mixing match= & call-template  (???)

Just shooting in the dark for ideas.

My best one so far is to generate unique names for all the xpaths I need to
match and do an explicit static-dispatch on the template (or function) name
…
But maybe there's a "trick" to get templates to be dynamically dispatched by
name & context node ?
like (I know this isnt valid …)

            <xsl:template name="format_striung"
match="some/xpath/expression" >

then call it with something like

            <xsl:call-template name="format_string" select=".">
                        <xsl:value-of  select="string()"/>
          </xsl:call-template>

Maybe this is what "mode" or pass-through parameters are for ?




Not asking anyone to work on this problem, but if something obvious comes to
mind I'd love to hear it !

Thanks.




----------------------------------------
David A. Lee
dlee(_at_)calldei(_dot_)com
http://www.xmlsh.org




----------------------------------------
David A. Lee
dlee(_at_)calldei(_dot_)com
http://www.xmlsh.org



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--