Subject: [xsl] Re: dynamically change modes based on parameters? have default modes? how? short code examples please :) From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx> Date: Fri, 12 Sep 2003 07:06:47 +0200 |
"SANWAL, ABHISHEK (HP-Houston)" <abhishek.sanwal@xxxxxx> wrote in message news:24B68DDCFD49004882CD8D02D2E4338AFFD0E1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > Yes. But I am having a bad time trying to use and push parameters > through other templates. Of course, I know now the way to "play" with > XSL. > > But there is one important question. > > There are multiple layouts I have inside these nested templates and I > need to conditionally apply certain kind of layouts using some > parameters. Now I am not sure if I can dynamically change the MODE that > applies for the next "nested" call to a template ( like this. ) > > <xsl:apply-templates select="./SectionBody" > mode={$SectionBodyModeParam}/> > <xsl:apply-templates select="./Paragraph" mode={$ParagraphModeParam}/> > > Is this possible? No. The value of the "mode" attribute must be a QName -- that is, among other things, it must be statically known at compile-time. The way to dynamically decide which tempalte to instantiate, based on parameters, is the base for the FXSL library -- read about this at: http://fxsl.sourceforge.net/articles/FuncProg/Functional%20Programming.html and http://www.idealliance.org/papers/extreme03/xslfo-pdf/2003/Novatchev01/EML2003Novatchev01.pdf One particularly elegant way to deal with parameters scoping is by using partial application -- described in the second reference above. ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] dynamically change modes base, SANWAL, ABHISHEK (HP | Thread | [xsl] [announce] XMLSPY 2004 availa, Larry E. Kim |
[xsl] Re: Do something if no items , Dimitre Novatchev | Date | [xsl] Re: how to: Conditionally cal, Dimitre Novatchev |
Month |