[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: dynamically change modes based on parameters? have
"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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|