Perl "join()"-like operation?

Subject: Perl "join()"-like operation?
From: Kyle Downey <kyle.downey@xxxxxxxxxxxxxxx>
Date: 25 Feb 00 18:05:37 EST
I'm using XSLT to generate SQL code (well, actually, I'm using it to generate
Java code with JDBC statements that include SQL, but that's not material to my
problem). This means generating text like this:

insert into TBAR (CODE_C, TIME_Z, NUM_I) values ('foo', '1/1/2000', 1)

I have XML code that contains the columns in a list, and can iterate over it
using <xsl:for-each> without any trouble. The catch is that nasty little comma
separator. In Java, I would normally either track the number I'm at in the
loop and add the comma only if not on the last element, or just truncate the
whole string by one once through to save on the if() each time through the
loop. But what about XSLT?

Basically, I need an operation that joins the text results of a select with a
given string, such as a comma, or I need a way to check to see if I'm on the
last iteration and not add the comma then.

Any suggestions? TIA.

regards,
kd


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


Current Thread