Using a variable for a template name

L

littlefitzer

Hi,
Say for example I want to use the following line in my XSL:
<xsl:call-template name="buildText"/>

I know I have to have a template defined named buildText.

My question is:
Is there a way to parse similarly named variables efficiently?
To elaborate, I had a template called buildText that would build some
text for me e.g.
<xsl:template name="buildText">
<lineOne>
<xsl:value-of select="$line"/>
parse some other stuff too.....
</lineOne>
....where line is defined as:
<xsl:variable name="line" select="'LINE'"/>

So that worked fine. Problem I now have is I have numerous lines I may
need to parse, and they are named LINE_1, LINE_2, LINE_3 etc. and also
maybe only LINE_1 and LINE_2 will be there and not LINE_3 and so on

Is there a way I can do this using the same template, possibly using a
variable?
i.e. call buildText_1 to parse LINE_1, buildText_2 to parse LINE_2,
but only have a single template defined called buildText?? where I can
replace the ?? with _1 or _2 etc as needed?

I hope this isn't too confusing. Thanks for any help,
Scott
 
A

Andy Dingley

I hope this isn't too confusing.

Damn close to it ! Took me several passes to try and understand what
you're asking for.

I think that all you're after here is a parameter, passed to the
template when you do the <xsl:call-template ... >
Look up <xsl:with-parameter ... >
 
L

littlefitzer

Thanks.
That sounds like what I might be after...would you be able to give me
an example? Sorry...fairly new to this.
Thanks again,
Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top