Subject: Re: [xsl] Dynamic dispatch of functions/templates (was matching text() ) From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Thu, 23 Dec 2010 08:30:55 -0800 |
> 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/EML2006Novat chev01.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@xxxxxxxxxxx> wrote: > Still thinking how to change > > B B B B B B B B B B B <xsl:apply-templates select="text()"/> > B B B B B B B B B B B b& > > <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 > B B B B B B B B B B B B B B B B B B B B B B <xsl:apply-templates select="text()"/> > > Doesnbt (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 > > B B B B B B B B B B B <xsl:call-template name="????"> > B B B B B B B B B B B B B B B B B B B B B B B <xsl:value-ofB select="string()"/> > B B B B B B B B B B </xsl:call-template> > > > I think I'm answering my own question b& I need to generate unique names b& > but maybe there's a way to mix these 2 modes ?B 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 doesnbt work, nor does mixing match= & call-templateB (???) > > 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 > b& > But maybe there's a "trick" to get templates to be dynamically dispatched by > name & context node ? > like (I know this isnt valid b&) > > B B B B B B B B B B B <xsl:template name="format_striung" > match="some/xpath/expression" > > > then call it with something like > > B B B B B B B B B B B <xsl:call-template name="format_string" select="."> > B B B B B B B B B B B B B B B B B B B B B B B <xsl:value-ofB select="string()"/> > B B B B B B B B B B </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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Dynamic dispatch of functions, David Lee | Thread | Re: [xsl] Dynamic dispatch of funct, Michael Kay |
Re: [xsl] Avoid repition of data, Michael Müller-Hille | Date | Re: [xsl] Avoid repition of data, Michael Kay |
Month |