[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Dynamic dispatch of functions/templates (was matching

Subject: Dynamic dispatch of functions/templates (was matching text() )
From: "David Lee" <dlee@xxxxxxxxxxx>
Date: Thu, 23 Dec 2010 09:37:01 -0500
 Dynamic dispatch of functions/templates (was matching
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()"/>

Doesnt (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 doesnt 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@xxxxxxxxxxx
http://www.xmlsh.org




----------------------------------------
David A. Lee
dlee@xxxxxxxxxxx
http://www.xmlsh.org

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.