This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: A better way to build a comma-delimited list
Fixed! Thanks Joerg and Tom. I made 2 small changes to the code below:
the "p" variable is not needed; and the substring can start at
position 3 and avoid an extra space at the beginning. Now the output
is perfect. AND the code is simpler. AND I've learned another way to
use xsl:variable. Thanks very much. (This list is amazing.)
John
> -----Original Message-----
> From: Joerg Heinicke <joerg.heinicke@gmx.de>
> Sent: Wednesday, May 15, 2002, 12:02:48 PM,
> Subject: [xsl] A better way to build a comma-delimited list
> While reading Tom's answer I hope the last lights are switched on in my
> head. It takes very long today ...
> > <xsl:text>select </xsl:text>
> > <xsl:variable name="string">
> > <xsl:for-each select="document($pbsdef)/pbsdef/column
> > [not(@dbcolumn=preceding-sibling::column/@dbcolumn)]">
> > <xsl:variable name="p" select="position()"/>
> > <xsl:variable name="dbcolumn" select="@dbcolumn"/>
> > <xsl:for-each select="$dbdef[key('dbdef-cols', $dbcolumn)]">
> > <xsl:text>, </xsl:text>
> > <xsl:value-of select="$dbcolumn"/>
> > </xsl:for-each>
> > </xsl:for-each>
> > </xsl:variable>
> > <xsl:value-of select="substring($string, 2)"/>
> It's only a bit easier than Tom's solution, because you don't need the
> string-length.
> Joerg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list