2013-02-04 61 views
1

如果你有代碼看起來或多或少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> 

回答

2

是,只需使用concat()功能:

<xsl:value-of select="concat($a0, $a1, $a2, ..., $an)" /> 
相關問題