xsl-list
[Top] [All Lists]

Re: dynamically change modes based on parameters? have default modes? how? short code examples please :)

2003-09-11 22:06:47

"SANWAL, ABHISHEK (HP-Houston)" <abhishek(_dot_)sanwal(_at_)hp(_dot_)com> wrote 
in message
news:24B68DDCFD49004882CD8D02D2E4338AFFD0E1(_at_)cceexc15(_dot_)americas(_dot_)cpqcorp(_dot_)net(_dot_)(_dot_)(_dot_)
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



<Prev in Thread] Current Thread [Next in Thread>