473,383 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Using a variable for a template name

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
Jul 20 '05 #1
2 1398
On 5 Oct 2004 15:58:35 -0700, li**********@hotmail.com (littlefitzer)
wrote:
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 ... >

--
Smert' spamionam
Jul 20 '05 #2
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
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Xeon | last post by:
Hi, I'm trying to replace spaces with %20 with help of translate, but not successfull. Here's a node in the xml file : <title>This is some test title</title> The xsl code I'm using : ...
6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
2
by: Gadrin77 | last post by:
as a newbie to XSL, is it possible to mimic a SELECT/CASE statement using XSL? I tried a quickie and I kept getting errors either using PARAM or WITH-PARAM in the wrong place or VARIABLE. I...
1
by: Scott | last post by:
I have an XML Document in a format like: <Variable name="Bob">ABCDEFG</Variable> <Variable name="Steve">QWERTYUI</Variable> <Variable name="John">POIUYTR</Variable> <Variable...
3
by: Sandros | last post by:
Background: I'm collecting usability statistics for a group of applications. Each count has the following attributes: date, application, major heading, minor heading, count. My intent is to pull...
4
by: afc46220 | last post by:
Hello, I am a novice with XSL, and can't quite figure out how to come up with a solution for the following problem. Let's assume we have the following set of XML nodes: <DataBlocks>...
10
by: William Krick | last post by:
I am writing an XSL transform that converts XML data about vehicles into XML data that will fill printed forms. The default form can handle up to 5 vehicles which I handle using subscripts... ...
7
by: pbd22 | last post by:
Hi. I am somewhat new to this and would like some advice. I want to search my xml file using "keyword" search and return results based on "proximity matching" - in other words, since the search...
1
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that...
9
by: shakilalig | last post by:
Hi All, I am writing an XSL to transform the XML to XML.Only change i need in xml is to add the value for the price element under book tag for which publisher location is "World". The...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.