Re: [xsl] A better way to build a comma-delimited list

Subject: Re: [xsl] A better way to build a comma-delimited list
From: John Sands <WonkoWatson@xxxxxxxxx>
Date: Wed, 15 May 2002 17:25:22 -0400
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@xxxxxx>
> 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


Current Thread