Question

if you have an XSL transform with code that looks more or less as follows:

<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"/>

... and you want to print the text value associated with each variable, is there a way to do it that's more elegant and concise than any of the following?

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>
Was it helpful?

Solution

Yes, just use the concat() function:

<xsl:value-of select="concat($a0, $a1, $a2, ..., $an)" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top