1

I am not a web developer but I was forced to do XSLT.

I have a variable (var1) being passed to an XSLT template which has these values 1,2,3,4. I need to display this as

1
2
3
4

I'm using the code below to display my values.

<\xsl:value-of select="var1"\>

How can it dynamically replace the commas with line feeds? I've tried replacing the commas with & #10; (using a program) but it did not work.

4

1 回答 1

1

如果你有<xsl:variable name="var1" select="'1,2,3,4'"/>那么使用<xsl:value-of select="translate($var1, ',', '&#10;')"/>就足够了。当然,只有使用输出方法文本或 HTML,<pre><xsl:value-of select="translate($var1, ',', '&#10;')"/></pre>您才会看到换行符。

于 2013-08-15T09:13:26.717 回答