什么是输出多个XSL变量值的最佳方式?
问题描述:
如果你有代码看起来或多或少XSL转换如下:什么是输出多个XSL变量值的最佳方式?
<xsl:variable name="a0" select="some expression"/>
<xsl:variable name="a1" select="some expression"/>
<xsl:variable name="a2" select="some expression"/>
...
<xsl:variable name="an" select="some expression"/>
...你要打印与每个变量相关联的文本价值,是有办法做到这一点是更优雅和简洁比以下任何一个?
1.
<xsl:value-of select="$a0"/>
<xsl:value-of select="$a1"/>
<xsl:value-of select="$a2"/>
...
<xsl:value-of select="$an"/>
2.
<xsl:foreach select="$a0 | $a1 | $a2 | ... | $an>
<xsl:value-of select="."/>
</xsl:foreach>
答
是,只需使用concat()
功能:
<xsl:value-of select="concat($a0, $a1, $a2, ..., $an)" />