Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Build a variable to build a comma delimited list?

Status
Not open for further replies.

metsey

Programmer
Mar 2, 2001
49
US
Is it possible to use a variable to build a comma delimited list of attribute values? I am using a for loop to iterate through a xml doc. While I am doing this I would like to build a comma-delimited list of values obtained from the same element/attribute as I for-loop. I will then use this list in a href.

Here is sample xml:

<rs:data>
<z:row Position=1 LedgerID=&quot;619568&quot;/>
<z:row Position=2 LedgerID=&quot;649185&quot;/>
<z:row Position=3 LedgerID=&quot;619642&quot;/>
</rs:data>

I would like to create a variable such as:
<xsl:variable name=&quot;LedgerIDString&quot;/>

and after the last loop have the variable value be
=&quot;619568,649185,619642&quot;

Can this be done?
 
Variables in XSL are static, however using recursion you can concatonise all of the values together. It can get a bit messy, but it can be done. If you want an example send more of your code and I'll see what I can do. Good Luck. MYenigmaSELF:-9
myenigmaself@myenigmaself.gaiden.com
&quot;If debugging is the process of removing bugs, then programming must be the process of putting them in.&quot; --Dykstra
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top