[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] how to pass parameters down through nested templates using xsl:apply templates in a nested fashion?


Subject: RE: [xsl] how to pass parameters down through nested templates using xsl:apply templates in a nested fashion?
From: "SANWAL, ABHISHEK (HP-Houston)" <abhishek.sanwal@xxxxxx>
Date: Thu, 11 Sep 2003 15:02:48 -0500

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? If so then what is the correct syntax and way that I
can use params here.

{ OFF-TOPIC CURIOSITY
Is it possible to make an apply-tempaltes call to different kinds of
children except one ( I have that expression working), but push
different modes for each.

Is it possible to assign "default" modes that get called when that
template match only has a template without any mode defined?
}

If this is not (even if it is)... would it be better to call a 
single template (with no modes, but has internally different layouts it
that can be applied)  like so... 

<xsl:apply-templates select="./SectionBody"/>
<xsl:apply-templates select="./Paragraph" mode={$ParagraphModeParam}/>

...and have the templates use internal logic <ifs and chooses> to decide
between applying the template layout based on the parameters it was
passed ?

I am trying to create this paradigm of functions with
"variables/parameters of normal programming languages" with different
scopes of operation (global/local.. and specify accurately the scope of
the parameters) in the above, I think. Not completely successful yet,
but would like to see it happen.

:)

Thanks. Please do advise on the above

Abhishek Sanwal
HP - Houston Campus
abhishek.sanwal@xxxxxx

-----Original Message-----
From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx] 
Sent: Thursday, September 11, 2003 10:21 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] how to pass parameters down through nested templates
using xsl:apply templates in a nested fashion?

Abhishek,

I'm glad you're figuring it all out.

At 04:42 AM 9/11/2003, you wrote:
>Although I am currently learning it the hard way, what's a good
>reference to examples/samples or a cookbook / tutorial to develop "test
>expressions" which I so often require, know the logic but have
>difficulty with syntax between () [] etc.

...

I know what you mean, and I have glanced, at least, at most of the XSLT 
books out there, and have my favorites ... nonetheless, since I don't 
really use them myself much (if I get really stuck I tend to look at the

spec, for a simple syntax thing;  if it's more complicated I usually set

the problem aside for a few hours until I think of a new angle that 
generally helps resolve it -- letting it rest is a technique that really

works for me), and never really did (like the authors of the books, I'm 
what you might call a "first-generation" XSLT user ... the books didn't 
exist when I was at that point) -- I think your question would be better

answered by those who have actual experience to refer to.

I wonder if anyone else -- maybe 2nd- or 3rd-gen (picked up XSLT after, 
say, 1999; used the books but has now internalized the rules for the
most 
part) -- could comment on their favorite references, cookbooks,
tutorials?

There is a huge amount of material out there, after all.

Oh, and don't forget the Mulberry XSLT Quick Reference at 
http://www.mulberrytech.com/quickref/index.html. In addition to listing
all 
the standard instructions, functions and operators, it tells you (if you

look closely enough) where you are allowed to use AVTs, along with
similar 
hints. Thank Tony Graham, my erstwhile colleage, for most of the work on
it.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords